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

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

Issue 184153002: - Update runtime/third_party/double-conversion to version 1.1.5. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 DiyFp* power, 145 DiyFp* power,
146 int* decimal_exponent) { 146 int* decimal_exponent) {
147 int kQ = DiyFp::kSignificandSize; 147 int kQ = DiyFp::kSignificandSize;
148 double k = ceil((min_exponent + kQ - 1) * kD_1_LOG2_10); 148 double k = ceil((min_exponent + kQ - 1) * kD_1_LOG2_10);
149 int foo = kCachedPowersOffset; 149 int foo = kCachedPowersOffset;
150 int index = 150 int index =
151 (foo + static_cast<int>(k) - 1) / kDecimalExponentDistance + 1; 151 (foo + static_cast<int>(k) - 1) / kDecimalExponentDistance + 1;
152 ASSERT(0 <= index && index < kCachedPowersLength); 152 ASSERT(0 <= index && index < kCachedPowersLength);
153 CachedPower cached_power = kCachedPowers[index]; 153 CachedPower cached_power = kCachedPowers[index];
154 ASSERT(min_exponent <= cached_power.binary_exponent); 154 ASSERT(min_exponent <= cached_power.binary_exponent);
155 (void) max_exponent; // Mark variable as used.
155 ASSERT(cached_power.binary_exponent <= max_exponent); 156 ASSERT(cached_power.binary_exponent <= max_exponent);
156 *decimal_exponent = cached_power.decimal_exponent; 157 *decimal_exponent = cached_power.decimal_exponent;
157 *power = DiyFp(cached_power.significand, cached_power.binary_exponent); 158 *power = DiyFp(cached_power.significand, cached_power.binary_exponent);
158 } 159 }
159 160
160 161
161 void PowersOfTenCache::GetCachedPowerForDecimalExponent(int requested_exponent, 162 void PowersOfTenCache::GetCachedPowerForDecimalExponent(int requested_exponent,
162 DiyFp* power, 163 DiyFp* power,
163 int* found_exponent) { 164 int* found_exponent) {
164 ASSERT(kMinDecimalExponent <= requested_exponent); 165 ASSERT(kMinDecimalExponent <= requested_exponent);
165 ASSERT(requested_exponent < kMaxDecimalExponent + kDecimalExponentDistance); 166 ASSERT(requested_exponent < kMaxDecimalExponent + kDecimalExponentDistance);
166 int index = 167 int index =
167 (requested_exponent + kCachedPowersOffset) / kDecimalExponentDistance; 168 (requested_exponent + kCachedPowersOffset) / kDecimalExponentDistance;
168 CachedPower cached_power = kCachedPowers[index]; 169 CachedPower cached_power = kCachedPowers[index];
169 *power = DiyFp(cached_power.significand, cached_power.binary_exponent); 170 *power = DiyFp(cached_power.significand, cached_power.binary_exponent);
170 *found_exponent = cached_power.decimal_exponent; 171 *found_exponent = cached_power.decimal_exponent;
171 ASSERT(*found_exponent <= requested_exponent); 172 ASSERT(*found_exponent <= requested_exponent);
172 ASSERT(requested_exponent < *found_exponent + kDecimalExponentDistance); 173 ASSERT(requested_exponent < *found_exponent + kDecimalExponentDistance);
173 } 174 }
174 175
175 } // namespace double_conversion 176 } // namespace double_conversion
OLDNEW
« no previous file with comments | « runtime/third_party/double-conversion/src/bignum-dtoa.cc ('k') | runtime/third_party/double-conversion/src/double.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698