[llvm] 5e29360 - [NFC] Add parentheses in MathExtra.h

Amaury Séchet via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 24 15:24:41 PDT 2022


Author: Amaury Séchet
Date: 2022-07-24T22:04:09Z
New Revision: 5e29360743ca822f6934877cc972295c2da5a38b

URL: https://github.com/llvm/llvm-project/commit/5e29360743ca822f6934877cc972295c2da5a38b
DIFF: https://github.com/llvm/llvm-project/commit/5e29360743ca822f6934877cc972295c2da5a38b.diff

LOG: [NFC] Add parentheses in MathExtra.h

The code used to cause a warning:
  llvm/include/llvm/Support/MathExtras.h:751:39: warning: suggest parentheses around ‘-’ in operand of ‘&’ [-Wparentheses]
    751 |   assert(Align != 0 && (Align & Align - 1) == 0 &&
        |

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 372dbaf364bf..94ecae9fc995 100644
--- a/llvm/include/llvm/Support/MathExtras.h
+++ b/llvm/include/llvm/Support/MathExtras.h
@@ -748,7 +748,7 @@ inline uint64_t alignTo(uint64_t Value, uint64_t Align) {
 }
 
 inline uint64_t alignToPowerOf2(uint64_t Value, uint64_t Align) {
-  assert(Align != 0 && (Align & Align - 1) == 0 &&
+  assert(Align != 0 && (Align & (Align - 1)) == 0 &&
          "Align must be a power of 2");
   return (Value + Align - 1) & -Align;
 }


        


More information about the llvm-commits mailing list