| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 {UINT64_2PART_C(0xeb96bf6e, badf77d9), 1039, 332}, | 134 {UINT64_2PART_C(0xeb96bf6e, badf77d9), 1039, 332}, |
| 135 {UINT64_2PART_C(0xaf87023b, 9bf0ee6b), 1066, 340}, | 135 {UINT64_2PART_C(0xaf87023b, 9bf0ee6b), 1066, 340}, |
| 136 }; | 136 }; |
| 137 static const int kCachedPowersOffset = 348; // -kCachedPowers[0].decimal_exp
onent | 137 static const int kCachedPowersOffset = 348; // -kCachedPowers[0].decimal_exp
onent |
| 138 | 138 |
| 139 const int PowersOfTenCache::kDecimalExponentDistance = 8; // kCachedPowers[1
].decimal_exponent - kCachedPowers[0].decimal_exponent | 139 const int PowersOfTenCache::kDecimalExponentDistance = 8; // kCachedPowers[1
].decimal_exponent - kCachedPowers[0].decimal_exponent |
| 140 const int PowersOfTenCache::kMinDecimalExponent = -348; // kCachedPowers[0].
decimal_exponent | 140 const int PowersOfTenCache::kMinDecimalExponent = -348; // kCachedPowers[0].
decimal_exponent |
| 141 const int PowersOfTenCache::kMaxDecimalExponent = 340; // kCachedPowers[kCac
hedPowersLength - 1].decimal_exponent | 141 const int PowersOfTenCache::kMaxDecimalExponent = 340; // kCachedPowers[kCac
hedPowersLength - 1].decimal_exponent |
| 142 | 142 |
| 143 #ifndef NDEBUG | 143 #ifndef NDEBUG |
| 144 #if ASSERT_ENABLED | 144 #if ENABLE(ASSERT) |
| 145 static const int kCachedPowersLength = ARRAY_SIZE(kCachedPowers); | 145 static const int kCachedPowersLength = ARRAY_SIZE(kCachedPowers); |
| 146 #endif | 146 #endif |
| 147 | 147 |
| 148 // Check that the static constants match the values in kCachedPowers. | 148 // Check that the static constants match the values in kCachedPowers. |
| 149 static void validateStaticConstants() { | 149 static void validateStaticConstants() { |
| 150 ASSERT(kCachedPowersOffset == -kCachedPowers[0].decimal_exponent); | 150 ASSERT(kCachedPowersOffset == -kCachedPowers[0].decimal_exponent); |
| 151 ASSERT(PowersOfTenCache::kDecimalExponentDistance == (kCachedPowers[1].d
ecimal_exponent - kCachedPowers[0].decimal_exponent)); | 151 ASSERT(PowersOfTenCache::kDecimalExponentDistance == (kCachedPowers[1].d
ecimal_exponent - kCachedPowers[0].decimal_exponent)); |
| 152 ASSERT(PowersOfTenCache::kMinDecimalExponent == kCachedPowers[0].decimal
_exponent); | 152 ASSERT(PowersOfTenCache::kMinDecimalExponent == kCachedPowers[0].decimal
_exponent); |
| 153 ASSERT(PowersOfTenCache::kMaxDecimalExponent == kCachedPowers[kCachedPow
ersLength - 1].decimal_exponent); | 153 ASSERT(PowersOfTenCache::kMaxDecimalExponent == kCachedPowers[kCachedPow
ersLength - 1].decimal_exponent); |
| 154 } | 154 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 CachedPower cached_power = kCachedPowers[index]; | 189 CachedPower cached_power = kCachedPowers[index]; |
| 190 *power = DiyFp(cached_power.significand, cached_power.binary_exponent); | 190 *power = DiyFp(cached_power.significand, cached_power.binary_exponent); |
| 191 *found_exponent = cached_power.decimal_exponent; | 191 *found_exponent = cached_power.decimal_exponent; |
| 192 ASSERT(*found_exponent <= requested_exponent); | 192 ASSERT(*found_exponent <= requested_exponent); |
| 193 ASSERT(requested_exponent < *found_exponent + kDecimalExponentDistance); | 193 ASSERT(requested_exponent < *found_exponent + kDecimalExponentDistance); |
| 194 } | 194 } |
| 195 | 195 |
| 196 } // namespace double_conversion | 196 } // namespace double_conversion |
| 197 | 197 |
| 198 } // namespace WTF | 198 } // namespace WTF |
| OLD | NEW |