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

Side by Side Diff: src/conversions.cc

Issue 1479773002: Remove custom win64 modulo code (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years 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
« no previous file with comments | « src/codegen.cc ('k') | src/v8.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "src/conversions.h" 5 #include "src/conversions.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stdarg.h> 8 #include <stdarg.h>
9 #include <cmath> 9 #include <cmath>
10 10
11 #include "src/assert-scope.h" 11 #include "src/assert-scope.h"
12 #include "src/char-predicates-inl.h" 12 #include "src/char-predicates-inl.h"
13 #include "src/codegen.h"
13 #include "src/conversions-inl.h" 14 #include "src/conversions-inl.h"
14 #include "src/dtoa.h" 15 #include "src/dtoa.h"
15 #include "src/factory.h" 16 #include "src/factory.h"
16 #include "src/list-inl.h" 17 #include "src/list-inl.h"
17 #include "src/strtod.h" 18 #include "src/strtod.h"
18 #include "src/utils.h" 19 #include "src/utils.h"
19 20
20 #ifndef _STLP_VENDOR_CSTD 21 #ifndef _STLP_VENDOR_CSTD
21 // STLPort doesn't import fpclassify into the std namespace. 22 // STLPort doesn't import fpclassify into the std namespace.
22 using std::fpclassify; 23 using std::fpclassify;
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 if (is_negative) value = -value; 434 if (is_negative) value = -value;
434 435
435 // Get the integer part and the decimal part. 436 // Get the integer part and the decimal part.
436 double integer_part = std::floor(value); 437 double integer_part = std::floor(value);
437 double decimal_part = value - integer_part; 438 double decimal_part = value - integer_part;
438 439
439 // Convert the integer part starting from the back. Always generate 440 // Convert the integer part starting from the back. Always generate
440 // at least one digit. 441 // at least one digit.
441 int integer_pos = kBufferSize - 2; 442 int integer_pos = kBufferSize - 2;
442 do { 443 do {
443 double remainder = std::fmod(integer_part, radix); 444 double remainder = modulo(integer_part, radix);
444 integer_buffer[integer_pos--] = chars[static_cast<int>(remainder)]; 445 integer_buffer[integer_pos--] = chars[static_cast<int>(remainder)];
445 integer_part -= remainder; 446 integer_part -= remainder;
446 integer_part /= radix; 447 integer_part /= radix;
447 } while (integer_part >= 1.0); 448 } while (integer_part >= 1.0);
448 // Sanity check. 449 // Sanity check.
449 DCHECK(integer_pos > 0); 450 DCHECK(integer_pos > 0);
450 // Add sign if needed. 451 // Add sign if needed.
451 if (is_negative) integer_buffer[integer_pos--] = '-'; 452 if (is_negative) integer_buffer[integer_pos--] = '-';
452 453
453 // Convert the decimal part. Repeatedly multiply by the radix to 454 // Convert the decimal part. Repeatedly multiply by the radix to
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 char reverse_buffer[kBufferSize + 1]; // Result will be /0 terminated. 555 char reverse_buffer[kBufferSize + 1]; // Result will be /0 terminated.
555 Vector<char> reverse_vector(reverse_buffer, arraysize(reverse_buffer)); 556 Vector<char> reverse_vector(reverse_buffer, arraysize(reverse_buffer));
556 const char* reverse_string = DoubleToCString(d, reverse_vector); 557 const char* reverse_string = DoubleToCString(d, reverse_vector);
557 for (int i = 0; i < length; ++i) { 558 for (int i = 0; i < length; ++i) {
558 if (static_cast<uint16_t>(reverse_string[i]) != buffer[i]) return false; 559 if (static_cast<uint16_t>(reverse_string[i]) != buffer[i]) return false;
559 } 560 }
560 return true; 561 return true;
561 } 562 }
562 } // namespace internal 563 } // namespace internal
563 } // namespace v8 564 } // namespace v8
OLDNEW
« no previous file with comments | « src/codegen.cc ('k') | src/v8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698