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

Side by Side Diff: src/conversions.cc

Issue 501323002: Replace our homegrown ARRAY_SIZE() with Chrome's arraysize(). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <limits.h> 5 #include <limits.h>
6 #include <stdarg.h> 6 #include <stdarg.h>
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "src/v8.h" 9 #include "src/v8.h"
10 10
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 double abs_value = value; 204 double abs_value = value;
205 if (value < 0) { 205 if (value < 0) {
206 abs_value = -value; 206 abs_value = -value;
207 negative = true; 207 negative = true;
208 } 208 }
209 209
210 // If abs_value has more than kMaxDigitsBeforePoint digits before the point 210 // If abs_value has more than kMaxDigitsBeforePoint digits before the point
211 // use the non-fixed conversion routine. 211 // use the non-fixed conversion routine.
212 if (abs_value >= kFirstNonFixed) { 212 if (abs_value >= kFirstNonFixed) {
213 char arr[100]; 213 char arr[100];
214 Vector<char> buffer(arr, ARRAY_SIZE(arr)); 214 Vector<char> buffer(arr, arraysize(arr));
215 return StrDup(DoubleToCString(value, buffer)); 215 return StrDup(DoubleToCString(value, buffer));
216 } 216 }
217 217
218 // Find a sufficiently precise decimal representation of n. 218 // Find a sufficiently precise decimal representation of n.
219 int decimal_point; 219 int decimal_point;
220 int sign; 220 int sign;
221 // Add space for the '\0' byte. 221 // Add space for the '\0' byte.
222 const int kDecimalRepCapacity = 222 const int kDecimalRepCapacity =
223 kMaxDigitsBeforePoint + kMaxDigitsAfterPoint + 1; 223 kMaxDigitsBeforePoint + kMaxDigitsAfterPoint + 1;
224 char decimal_rep[kDecimalRepCapacity]; 224 char decimal_rep[kDecimalRepCapacity];
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 return StringToDouble( 494 return StringToDouble(
495 unicode_cache, flat.ToOneByteVector(), flags, empty_string_val); 495 unicode_cache, flat.ToOneByteVector(), flags, empty_string_val);
496 } else { 496 } else {
497 return StringToDouble( 497 return StringToDouble(
498 unicode_cache, flat.ToUC16Vector(), flags, empty_string_val); 498 unicode_cache, flat.ToUC16Vector(), flags, empty_string_val);
499 } 499 }
500 } 500 }
501 501
502 502
503 } } // namespace v8::internal 503 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698