[libc-commits] [PATCH] D140967: [libc] get_table_negative cannot be constexpr

Guillaume Chatelet via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Jan 4 04:09:22 PST 2023


gchatelet created this revision.
gchatelet added a reviewer: lntue.
Herald added subscribers: libc-commits, ecnelises, tschuett.
Herald added projects: libc-project, All.
gchatelet requested review of this revision.

GCC complains about if conditions not being constant expressions.
As-is get_table_negative cannot be marked constexpr.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140967

Files:
  libc/src/__support/float_to_string.h


Index: libc/src/__support/float_to_string.h
===================================================================
--- libc/src/__support/float_to_string.h
+++ libc/src/__support/float_to_string.h
@@ -130,8 +130,8 @@
 // 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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140967.486233.patch
Type: text/x-patch
Size: 711 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230104/4af3ce5e/attachment.bin>


More information about the libc-commits mailing list