[libc-commits] [PATCH] D150399: [libc] add options to printf decimal floats

Tue Ly via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu May 18 17:29:46 PDT 2023


lntue accepted this revision.
lntue added inline comments.
This revision is now accepted and ready to land.


================
Comment at: libc/src/__support/float_to_string.h:570-575
+    // const int idx = -exponent / IDX_SIZE;
+    // constexpr int idx_min = (IDX_SIZE / 4) + 1;
+    // if (idx < idx_min) {
+    //   return 0;
+    // }
+    // return static_cast<size_t>(idx - idx_min) / 2;
----------------
Are those still relevant?


================
Comment at: libc/src/__support/float_to_string.h:603-608
+  // const int idx = -exponent / IDX_SIZE;
+  // constexpr int idx_min = (IDX_SIZE / 4) + 1;
+  // if (idx < idx_min) {
+  //   return 0;
+  // }
+  // return static_cast<size_t>(idx - idx_min) / 2;
----------------
Are those still relevant?


================
Comment at: libc/src/__support/float_to_string.h:635
+    // ------------------------------ TABLE MODE -------------------------------
+    const uint32_t shift_amount =
+        POW10_ADDITIONAL_BITS_TABLE + pos_exp - exponent;
----------------
The definitions of `shift_amount` are the same in all branches?


================
Comment at: libc/src/__support/float_to_string.h:686
+    // ------------------------------ TABLE MODE -------------------------------
+    const int32_t shift_amount =
+        POW10_ADDITIONAL_BITS_TABLE + (-exponent - IDX_SIZE * idx);
----------------
The definitions of `shift_amount` are the same in all branches?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150399/new/

https://reviews.llvm.org/D150399



More information about the libc-commits mailing list