[llvm] 5953943 - [Support] AbsoluteDifference - add brackets to appease static analyzer warning. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 17 05:47:19 PDT 2021


Author: Simon Pilgrim
Date: 2021-04-17T13:47:02+01:00
New Revision: 595394321d51c49e317a8a8da944e203f9b8633c

URL: https://github.com/llvm/llvm-project/commit/595394321d51c49e317a8a8da944e203f9b8633c
DIFF: https://github.com/llvm/llvm-project/commit/595394321d51c49e317a8a8da944e203f9b8633c.diff

LOG: [Support] AbsoluteDifference - add brackets to appease static analyzer warning. NFCI.

Added: 
    

Modified: 
    llvm/include/llvm/Support/MathExtras.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/MathExtras.h b/llvm/include/llvm/Support/MathExtras.h
index 10d4260a7eb15..753b1998c40c0 100644
--- a/llvm/include/llvm/Support/MathExtras.h
+++ b/llvm/include/llvm/Support/MathExtras.h
@@ -792,7 +792,7 @@ inline int64_t SignExtend64(uint64_t X, unsigned B) {
 /// value of the result.
 template <typename T>
 std::enable_if_t<std::is_unsigned<T>::value, T> AbsoluteDifference(T X, T Y) {
-  return X > Y ? X - Y : Y - X;
+  return X > Y ? (X - Y) : (Y - X);
 }
 
 /// Add two unsigned integers, X and Y, of type T.  Clamp the result to the


        


More information about the llvm-commits mailing list