[libc-commits] [libc] abcdc26 - [libc] get_table_negative cannot be constexpr
Guillaume Chatelet via libc-commits
libc-commits at lists.llvm.org
Thu Jan 5 06:31:46 PST 2023
Author: Guillaume Chatelet
Date: 2023-01-05T14:28:50Z
New Revision: abcdc26a81d183e3256ce2751530a971ef6c4191
URL: https://github.com/llvm/llvm-project/commit/abcdc26a81d183e3256ce2751530a971ef6c4191
DIFF: https://github.com/llvm/llvm-project/commit/abcdc26a81d183e3256ce2751530a971ef6c4191.diff
LOG: [libc] get_table_negative cannot be constexpr
GCC complains about if conditions not being constant expressions.
As-is get_table_negative cannot be marked constexpr.
Differential Revision: https://reviews.llvm.org/D140967
Added:
Modified:
libc/src/__support/float_to_string.h
Removed:
################################################################################
diff --git a/libc/src/__support/float_to_string.h b/libc/src/__support/float_to_string.h
index e9814843a5dd..da1defa7646a 100644
--- a/libc/src/__support/float_to_string.h
+++ b/libc/src/__support/float_to_string.h
@@ -130,8 +130,8 @@ get_table_positive(int exponent, size_t i, const size_t constant) {
// calculations.
// The formula being used looks more like this:
// floor(10^(9*(-i)) * 2^(c_0 + (-e))) % (10^9 * 2^c_0)
-constexpr inline cpp::UInt<MID_INT_SIZE>
-get_table_negative(int exponent, size_t i, const size_t constant) {
+inline cpp::UInt<MID_INT_SIZE> get_table_negative(int exponent, size_t i,
+ const size_t constant) {
constexpr size_t INT_SIZE = 1024;
int shift_amount = constant - exponent;
cpp::UInt<INT_SIZE> num(1);
More information about the libc-commits
mailing list