From bff0e281ee36b0719d16c1fc4e7fccd0920336b5 Mon Sep 17 00:00:00 2001 From: "erik.corry@gmail.com" Date: Fri, 7 Oct 2011 08:21:21 +0000 Subject: [PATCH] Change cached powers of 10 to avoid constants that need a static initializer to be called on process startup instead of being in the read-only section. Review URL: http://codereview.chromium.org/8177018 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9544 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/cached-powers.cc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/cached-powers.cc b/src/cached-powers.cc index 30a67a661..9241d2658 100644 --- a/src/cached-powers.cc +++ b/src/cached-powers.cc @@ -134,14 +134,12 @@ static const CachedPower kCachedPowers[] = { }; static const int kCachedPowersLength = ARRAY_SIZE(kCachedPowers); -static const int kCachedPowersOffset = -kCachedPowers[0].decimal_exponent; +static const int kCachedPowersOffset = 348; // -1 * the first decimal_exponent. static const double kD_1_LOG2_10 = 0.30102999566398114; // 1 / lg(10) -const int PowersOfTenCache::kDecimalExponentDistance = - kCachedPowers[1].decimal_exponent - kCachedPowers[0].decimal_exponent; -const int PowersOfTenCache::kMinDecimalExponent = - kCachedPowers[0].decimal_exponent; -const int PowersOfTenCache::kMaxDecimalExponent = - kCachedPowers[kCachedPowersLength - 1].decimal_exponent; +// Difference between the decimal exponents in the table above. +const int PowersOfTenCache::kDecimalExponentDistance = 8; +const int PowersOfTenCache::kMinDecimalExponent = -348; +const int PowersOfTenCache::kMaxDecimalExponent = 340; void PowersOfTenCache::GetCachedPowerForBinaryExponentRange( int min_exponent, -- 2.34.1