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

Side by Side Diff: third_party/WebKit/Source/platform/wtf/dtoa/fast-dtoa.cc

Issue 2846303002: Replace ASSERT with DCHECK in platform/ (Closed)
Patch Set: rebase Created 3 years, 7 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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 } 707 }
708 708
709 709
710 bool FastDtoa(double v, 710 bool FastDtoa(double v,
711 FastDtoaMode mode, 711 FastDtoaMode mode,
712 int requested_digits, 712 int requested_digits,
713 Vector<char> buffer, 713 Vector<char> buffer,
714 int* length, 714 int* length,
715 int* decimal_point) { 715 int* decimal_point) {
716 ASSERT(v > 0); 716 ASSERT(v > 0);
717 ASSERT(!Double(v).IsSpecial()); 717 DCHECK(!Double(v).IsSpecial());
718 718
719 bool result = false; 719 bool result = false;
720 int decimal_exponent = 0; 720 int decimal_exponent = 0;
721 switch (mode) { 721 switch (mode) {
722 case FAST_DTOA_SHORTEST: 722 case FAST_DTOA_SHORTEST:
723 result = Grisu3(v, buffer, length, &decimal_exponent); 723 result = Grisu3(v, buffer, length, &decimal_exponent);
724 break; 724 break;
725 case FAST_DTOA_PRECISION: 725 case FAST_DTOA_PRECISION:
726 result = Grisu3Counted(v, requested_digits, 726 result = Grisu3Counted(v, requested_digits,
727 buffer, length, &decimal_exponent); 727 buffer, length, &decimal_exponent);
728 break; 728 break;
729 default: 729 default:
730 UNREACHABLE(); 730 UNREACHABLE();
731 } 731 }
732 if (result) { 732 if (result) {
733 *decimal_point = *length + decimal_exponent; 733 *decimal_point = *length + decimal_exponent;
734 buffer[*length] = '\0'; 734 buffer[*length] = '\0';
735 } 735 }
736 return result; 736 return result;
737 } 737 }
738 738
739 } // namespace double_conversion 739 } // namespace double_conversion
740 740
741 } // namespace WTF 741 } // namespace WTF
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698