summaryrefslogtreecommitdiff
path: root/absl/strings/substitute.h
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2022-10-03 17:25:20 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2022-10-03 17:26:17 -0700
commit535f22b4a08a11166c91fabc22fe130933c745a7 (patch)
treecbf903d06406ad1442915472b6be1a859117418b /absl/strings/substitute.h
parentf19051447ff8f3feb5f1f9abb8d0df2337347781 (diff)
Replace the kPower10ExponentTable array with a formula.
sizeof(kPower10ExponentTable) = 651 * sizeof(int16_t) = 1302 bytes. Their equivalence can be confirmed by this test program: ``` const int minIncl = -342; const int maxExcl = 309; const int kPower10ExponentTable[] = { etc }; int Power10Exponent(int n) { return kPower10ExponentTable[n - minIncl]; } int main(int argc, char** argv) { for (int n = minIncl; n < maxExcl; n++) { int formula = (217706 * n >> 16) - 63; int table = Power10Exponent(n); if (formula != table) { return 1; } } return 0; } ``` Tested by atod_manual_test over the parse-number-fxx-test-data test cases, with and without manually disabling the EiselLemire code path, noting that changing the magic 217706 value causes test failures. PiperOrigin-RevId: 478646550 Change-Id: Icaaf106f9aa36e2de057f3bc9aeddc3ae0efade6
Diffstat (limited to 'absl/strings/substitute.h')
0 files changed, 0 insertions, 0 deletions