diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index a713d6e3bd030e..206cf6ee09d244 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.