-
Notifications
You must be signed in to change notification settings - Fork 10.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[libc][stdbit] Fix truncation err in CPP bit_ceil #84683
Conversation
Adding @lntue as reviewer. |
@llvm/pr-subscribers-libc Author: Michael Flanders (Flandini) ChangesAfter #84657 was merged, buildbot is reporting two errors for libc-x86_64-debian-gcc-fullbuild-dbg. This PR fixes the truncation error when calling The errors are:
Full diff: https://github.com/llvm/llvm-project/pull/84683.diff 1 Files Affected:
diff --git a/libc/src/__support/CPP/bit.h b/libc/src/__support/CPP/bit.h
index 4464703e4b064e..1a05728b850653 100644
--- a/libc/src/__support/CPP/bit.h
+++ b/libc/src/__support/CPP/bit.h
@@ -193,7 +193,7 @@ template <typename T>
bit_ceil(T value) {
if (value < 2)
return 1;
- return static_cast<T>(T(1) << cpp::bit_width<T>(value - 1u));
+ return static_cast<T>(T(1) << cpp::bit_width(value - 1U));
}
// Rotate algorithms make use of "Safe, Efficient, and Portable Rotate in C/C++"
|
Thanks for the patch! |
After #84657 was merged, buildbot is reporting two errors for libc-x86_64-debian-gcc-fullbuild-dbg. This PR addresses the truncation error for
CPP::bit_ceil<unsigned char>
andCPP::bit_ceil<unsigned short>
.The errors are: