summarylogtreecommitdiffstats
path: root/fix-saturated_arithmetic.patch
blob: f9a18220a99b1a9c53aa28252f05afcf0edcbfe7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
--- qtwebkit-2.3.4/Source/WTF/wtf/SaturatedArithmetic.h	2014-09-24 13:42:05.000000000 +0200
+++ qtwebkit-2.3.4/Source/WTF/wtf/SaturatedArithmetic.h	2017-02-19 16:27:58.343676787 +0100
@@ -43,7 +43,7 @@
 
     // Can only overflow if the signed bit of the two values match. If the signed
     // bit of the result and one of the values differ it did overflow.
-    if (!((ua ^ ub) >> 31) & (result ^ ua) >> 31)
+    if (~((ua ^ ub) >> 31) & ((result ^ ua) >> 31))
         result = std::numeric_limits<int>::max() + (ua >> 31);
 
     return result;
@@ -57,7 +57,7 @@
 
     // Can only overflow if the signed bit of the two values do not match. If the
     // signed bit of the result and the first value differ it did overflow.
-    if ((ua ^ ub) >> 31 & (result ^ ua) >> 31)
+    if (((ua ^ ub) >> 31) & ((result ^ ua) >> 31))
         result = std::numeric_limits<int>::max() + (ua >> 31);
 
     return result;