Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: third_party/double-conversion/src/cached-powers.cc

Issue 2019983002: Roll third_party/double_conversion (Closed) Base URL: git@github.com:dartino/sdk.git@master
Patch Set: Minor update Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 void PowersOfTenCache::GetCachedPowerForBinaryExponentRange( 141 void PowersOfTenCache::GetCachedPowerForBinaryExponentRange(
142 int min_exponent, 142 int min_exponent,
143 int max_exponent, 143 int max_exponent,
144 DiyFp* power, 144 DiyFp* power,
145 int* decimal_exponent) { 145 int* decimal_exponent) {
146 int kQ = DiyFp::kSignificandSize; 146 int kQ = DiyFp::kSignificandSize;
147 double k = ceil((min_exponent + kQ - 1) * kD_1_LOG2_10); 147 double k = ceil((min_exponent + kQ - 1) * kD_1_LOG2_10);
148 int foo = kCachedPowersOffset; 148 int foo = kCachedPowersOffset;
149 int index = 149 int index =
150 (foo + static_cast<int>(k) - 1) / kDecimalExponentDistance + 1; 150 (foo + static_cast<int>(k) - 1) / kDecimalExponentDistance + 1;
151 ASSERT(0 <= index && index < static_cast<int>(ARRAY_SIZE(kCachedPowers)));
151 CachedPower cached_power = kCachedPowers[index]; 152 CachedPower cached_power = kCachedPowers[index];
152 ASSERT(min_exponent <= cached_power.binary_exponent); 153 ASSERT(min_exponent <= cached_power.binary_exponent);
153 (void) max_exponent; // Mark variable as used. 154 (void) max_exponent; // Mark variable as used.
154 ASSERT(cached_power.binary_exponent <= max_exponent); 155 ASSERT(cached_power.binary_exponent <= max_exponent);
155 *decimal_exponent = cached_power.decimal_exponent; 156 *decimal_exponent = cached_power.decimal_exponent;
156 *power = DiyFp(cached_power.significand, cached_power.binary_exponent); 157 *power = DiyFp(cached_power.significand, cached_power.binary_exponent);
157 } 158 }
158 159
159 160
160 void PowersOfTenCache::GetCachedPowerForDecimalExponent(int requested_exponent, 161 void PowersOfTenCache::GetCachedPowerForDecimalExponent(int requested_exponent,
161 DiyFp* power, 162 DiyFp* power,
162 int* found_exponent) { 163 int* found_exponent) {
163 ASSERT(kMinDecimalExponent <= requested_exponent); 164 ASSERT(kMinDecimalExponent <= requested_exponent);
164 ASSERT(requested_exponent < kMaxDecimalExponent + kDecimalExponentDistance); 165 ASSERT(requested_exponent < kMaxDecimalExponent + kDecimalExponentDistance);
165 int index = 166 int index =
166 (requested_exponent + kCachedPowersOffset) / kDecimalExponentDistance; 167 (requested_exponent + kCachedPowersOffset) / kDecimalExponentDistance;
167 CachedPower cached_power = kCachedPowers[index]; 168 CachedPower cached_power = kCachedPowers[index];
168 *power = DiyFp(cached_power.significand, cached_power.binary_exponent); 169 *power = DiyFp(cached_power.significand, cached_power.binary_exponent);
169 *found_exponent = cached_power.decimal_exponent; 170 *found_exponent = cached_power.decimal_exponent;
170 ASSERT(*found_exponent <= requested_exponent); 171 ASSERT(*found_exponent <= requested_exponent);
171 ASSERT(requested_exponent < *found_exponent + kDecimalExponentDistance); 172 ASSERT(requested_exponent < *found_exponent + kDecimalExponentDistance);
172 } 173 }
173 174
174 } // namespace double_conversion 175 } // namespace double_conversion
OLDNEW
« no previous file with comments | « third_party/double-conversion/src/bignum.cc ('k') | third_party/double-conversion/src/double-conversion.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698