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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 {UINT64_2PART_C(0xe7109bfb, a19c0c9d), 853, 276}, | 128 {UINT64_2PART_C(0xe7109bfb, a19c0c9d), 853, 276}, |
129 {UINT64_2PART_C(0xac2820d9, 623bf429), 880, 284}, | 129 {UINT64_2PART_C(0xac2820d9, 623bf429), 880, 284}, |
130 {UINT64_2PART_C(0x80444b5e, 7aa7cf85), 907, 292}, | 130 {UINT64_2PART_C(0x80444b5e, 7aa7cf85), 907, 292}, |
131 {UINT64_2PART_C(0xbf21e440, 03acdd2d), 933, 300}, | 131 {UINT64_2PART_C(0xbf21e440, 03acdd2d), 933, 300}, |
132 {UINT64_2PART_C(0x8e679c2f, 5e44ff8f), 960, 308}, | 132 {UINT64_2PART_C(0x8e679c2f, 5e44ff8f), 960, 308}, |
133 {UINT64_2PART_C(0xd433179d, 9c8cb841), 986, 316}, | 133 {UINT64_2PART_C(0xd433179d, 9c8cb841), 986, 316}, |
134 {UINT64_2PART_C(0x9e19db92, b4e31ba9), 1013, 324}, | 134 {UINT64_2PART_C(0x9e19db92, b4e31ba9), 1013, 324}, |
135 {UINT64_2PART_C(0xeb96bf6e, badf77d9), 1039, 332}, | 135 {UINT64_2PART_C(0xeb96bf6e, badf77d9), 1039, 332}, |
136 {UINT64_2PART_C(0xaf87023b, 9bf0ee6b), 1066, 340}, | 136 {UINT64_2PART_C(0xaf87023b, 9bf0ee6b), 1066, 340}, |
137 }; | 137 }; |
138 static const int kCachedPowersLength = ARRAY_SIZE(kCachedPowers); | |
139 static const int kCachedPowersOffset = 348; // -kCachedPowers[0].decimal_exp
onent | 138 static const int kCachedPowersOffset = 348; // -kCachedPowers[0].decimal_exp
onent |
140 | 139 |
141 const int PowersOfTenCache::kDecimalExponentDistance = 8; // kCachedPowers[1
].decimal_exponent - kCachedPowers[0].decimal_exponent | 140 const int PowersOfTenCache::kDecimalExponentDistance = 8; // kCachedPowers[1
].decimal_exponent - kCachedPowers[0].decimal_exponent |
142 const int PowersOfTenCache::kMinDecimalExponent = -348; // kCachedPowers[0].
decimal_exponent | 141 const int PowersOfTenCache::kMinDecimalExponent = -348; // kCachedPowers[0].
decimal_exponent |
143 const int PowersOfTenCache::kMaxDecimalExponent = 340; // kCachedPowers[kCac
hedPowersLength - 1].decimal_exponent | 142 const int PowersOfTenCache::kMaxDecimalExponent = 340; // kCachedPowers[kCac
hedPowersLength - 1].decimal_exponent |
144 | 143 |
145 #ifndef NDEBUG | 144 #ifndef NDEBUG |
| 145 #if !ASSERT_DISABLED |
| 146 static const int kCachedPowersLength = ARRAY_SIZE(kCachedPowers); |
| 147 #endif |
| 148 |
146 // Check that the static constants match the values in kCachedPowers. | 149 // Check that the static constants match the values in kCachedPowers. |
147 static void validateStaticConstants() { | 150 static void validateStaticConstants() { |
148 ASSERT(kCachedPowersOffset == -kCachedPowers[0].decimal_exponent); | 151 ASSERT(kCachedPowersOffset == -kCachedPowers[0].decimal_exponent); |
149 ASSERT(PowersOfTenCache::kDecimalExponentDistance == (kCachedPowers[1].d
ecimal_exponent - kCachedPowers[0].decimal_exponent)); | 152 ASSERT(PowersOfTenCache::kDecimalExponentDistance == (kCachedPowers[1].d
ecimal_exponent - kCachedPowers[0].decimal_exponent)); |
150 ASSERT(PowersOfTenCache::kMinDecimalExponent == kCachedPowers[0].decimal
_exponent); | 153 ASSERT(PowersOfTenCache::kMinDecimalExponent == kCachedPowers[0].decimal
_exponent); |
151 ASSERT(PowersOfTenCache::kMaxDecimalExponent == kCachedPowers[kCachedPow
ersLength - 1].decimal_exponent); | 154 ASSERT(PowersOfTenCache::kMaxDecimalExponent == kCachedPowers[kCachedPow
ersLength - 1].decimal_exponent); |
152 } | 155 } |
153 #endif | 156 #endif |
154 | 157 |
155 void PowersOfTenCache::GetCachedPowerForBinaryExponentRange( | 158 void PowersOfTenCache::GetCachedPowerForBinaryExponentRange( |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 CachedPower cached_power = kCachedPowers[index]; | 191 CachedPower cached_power = kCachedPowers[index]; |
189 *power = DiyFp(cached_power.significand, cached_power.binary_exponent); | 192 *power = DiyFp(cached_power.significand, cached_power.binary_exponent); |
190 *found_exponent = cached_power.decimal_exponent; | 193 *found_exponent = cached_power.decimal_exponent; |
191 ASSERT(*found_exponent <= requested_exponent); | 194 ASSERT(*found_exponent <= requested_exponent); |
192 ASSERT(requested_exponent < *found_exponent + kDecimalExponentDistance); | 195 ASSERT(requested_exponent < *found_exponent + kDecimalExponentDistance); |
193 } | 196 } |
194 | 197 |
195 } // namespace double_conversion | 198 } // namespace double_conversion |
196 | 199 |
197 } // namespace WTF | 200 } // namespace WTF |
OLD | NEW |