| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 #endif | 151 #endif |
| 152 | 152 |
| 153 void PowersOfTenCache::GetCachedPowerForBinaryExponentRange( | 153 void PowersOfTenCache::GetCachedPowerForBinaryExponentRange( |
| 154 int min_exponent
, | 154 int min_exponent
, |
| 155 int max_exponent
, | 155 int max_exponent
, |
| 156 DiyFp* power, | 156 DiyFp* power, |
| 157 int* decimal_exp
onent) { | 157 int* decimal_exp
onent) { |
| 158 #if ENABLE(ASSERT) | 158 #if ENABLE(ASSERT) |
| 159 validateStaticConstants(); | 159 validateStaticConstants(); |
| 160 #endif | 160 #endif |
| 161 int kQ = DiyFp::kSignificandSize; | 161 const int kQ = DiyFp::kSignificandSize; |
| 162 double k = ceil((min_exponent + kQ - 1) * kD_1_LOG2_10); | 162 double k = ceil((min_exponent + kQ - 1) * kD_1_LOG2_10); |
| 163 int foo = kCachedPowersOffset; | 163 int foo = kCachedPowersOffset; |
| 164 int index = | 164 int index = |
| 165 (foo + static_cast<int>(k) - 1) / kDecimalExponentDistance + 1; | 165 (foo + static_cast<int>(k) - 1) / kDecimalExponentDistance + 1; |
| 166 ASSERT(0 <= index && index < kCachedPowersLength); | 166 ASSERT(0 <= index && index < kCachedPowersLength); |
| 167 CachedPower cached_power = kCachedPowers[index]; | 167 CachedPower cached_power = kCachedPowers[index]; |
| 168 ASSERT(min_exponent <= cached_power.binary_exponent); | 168 ASSERT(min_exponent <= cached_power.binary_exponent); |
| 169 ASSERT(cached_power.binary_exponent <= max_exponent); | 169 ASSERT(cached_power.binary_exponent <= max_exponent); |
| 170 *decimal_exponent = cached_power.decimal_exponent; | 170 *decimal_exponent = cached_power.decimal_exponent; |
| 171 *power = DiyFp(cached_power.significand, cached_power.binary_exponent); | 171 *power = DiyFp(cached_power.significand, cached_power.binary_exponent); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 185 CachedPower cached_power = kCachedPowers[index]; | 185 CachedPower cached_power = kCachedPowers[index]; |
| 186 *power = DiyFp(cached_power.significand, cached_power.binary_exponent); | 186 *power = DiyFp(cached_power.significand, cached_power.binary_exponent); |
| 187 *found_exponent = cached_power.decimal_exponent; | 187 *found_exponent = cached_power.decimal_exponent; |
| 188 ASSERT(*found_exponent <= requested_exponent); | 188 ASSERT(*found_exponent <= requested_exponent); |
| 189 ASSERT(requested_exponent < *found_exponent + kDecimalExponentDistance); | 189 ASSERT(requested_exponent < *found_exponent + kDecimalExponentDistance); |
| 190 } | 190 } |
| 191 | 191 |
| 192 } // namespace double_conversion | 192 } // namespace double_conversion |
| 193 | 193 |
| 194 } // namespace WTF | 194 } // namespace WTF |
| OLD | NEW |