[clang] 7e629e4 - [AST] Use llvm::bit_width (NFC)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 25 22:59:56 PST 2023


Author: Kazu Hirata
Date: 2023-01-25T22:59:51-08:00
New Revision: 7e629e4e888262abd8f076512b252208acd72d62

URL: https://github.com/llvm/llvm-project/commit/7e629e4e888262abd8f076512b252208acd72d62
DIFF: https://github.com/llvm/llvm-project/commit/7e629e4e888262abd8f076512b252208acd72d62.diff

LOG: [AST] Use llvm::bit_width (NFC)

Added: 
    

Modified: 
    clang/lib/AST/Type.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp
index a713d6e3bd03..206cf6ee09d2 100644
--- a/clang/lib/AST/Type.cpp
+++ b/clang/lib/AST/Type.cpp
@@ -158,7 +158,7 @@ unsigned ConstantArrayType::getNumAddressingBits(const ASTContext &Context,
   if ((ElementSize >> 32) == 0 && NumElements.getBitWidth() <= 64 &&
       (NumElements.getZExtValue() >> 32) == 0) {
     uint64_t TotalSize = NumElements.getZExtValue() * ElementSize;
-    return 64 - llvm::countLeadingZeros(TotalSize);
+    return llvm::bit_width(TotalSize);
   }
 
   // Otherwise, use APSInt to handle arbitrary sized values.


        


More information about the cfe-commits mailing list