include/o3tl/safeint.hxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
New commits: commit ade8521657d5d52cd5d67a60859f34c1b32c8e34 Author: Stephan Bergmann <sberg...@redhat.com> Date: Thu Oct 26 15:33:40 2017 +0200 Fix o3tl::saturating_add for negative b Change-Id: I665f6c2f94b6c03d6fb5136fff3054ad6f0ca962 diff --git a/include/o3tl/safeint.hxx b/include/o3tl/safeint.hxx index 8b735fe2edfa..47baccf067f8 100644 --- a/include/o3tl/safeint.hxx +++ b/include/o3tl/safeint.hxx @@ -37,8 +37,8 @@ typename std::enable_if<std::is_signed<T>::value, T>::type saturating_add( return std::numeric_limits<T>::max(); } } else { - if (a >= std::numeric_limits<T>::min() + b) { - return a - b; + if (a >= std::numeric_limits<T>::min() - b) { + return a + b; } else { return std::numeric_limits<T>::min(); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits