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

Side by Side Diff: src/conversions-inl.h

Issue 121303005: Use std:: on symbols declared in C++-style C headers. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Same as the previous CL, but with an addition to cctest/test-log.cc Created 6 years, 11 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
« no previous file with comments | « src/conversions.cc ('k') | src/cpu.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 // 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 return negative ? ~result + 1 : result; 81 return negative ? ~result + 1 : result;
82 } 82 }
83 // Large number (outside uint32 range), Infinity or NaN. 83 // Large number (outside uint32 range), Infinity or NaN.
84 return 0x80000000u; // Return integer indefinite. 84 return 0x80000000u; // Return integer indefinite.
85 } 85 }
86 86
87 87
88 inline double DoubleToInteger(double x) { 88 inline double DoubleToInteger(double x) {
89 if (std::isnan(x)) return 0; 89 if (std::isnan(x)) return 0;
90 if (!std::isfinite(x) || x == 0) return x; 90 if (!std::isfinite(x) || x == 0) return x;
91 return (x >= 0) ? floor(x) : ceil(x); 91 return (x >= 0) ? std::floor(x) : std::ceil(x);
92 } 92 }
93 93
94 94
95 int32_t DoubleToInt32(double x) { 95 int32_t DoubleToInt32(double x) {
96 int32_t i = FastD2I(x); 96 int32_t i = FastD2I(x);
97 if (FastI2D(i) == x) return i; 97 if (FastI2D(i) == x) return i;
98 Double d(x); 98 Double d(x);
99 int exponent = d.Exponent(); 99 int exponent = d.Exponent();
100 if (exponent < 0) { 100 if (exponent < 0) {
101 if (exponent <= -Double::kSignificandSize) return 0; 101 if (exponent <= -Double::kSignificandSize) return 0;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 226
227 if (exponent == 0) { 227 if (exponent == 0) {
228 if (negative) { 228 if (negative) {
229 if (number == 0) return -0.0; 229 if (number == 0) return -0.0;
230 number = -number; 230 number = -number;
231 } 231 }
232 return static_cast<double>(number); 232 return static_cast<double>(number);
233 } 233 }
234 234
235 ASSERT(number != 0); 235 ASSERT(number != 0);
236 return ldexp(static_cast<double>(negative ? -number : number), exponent); 236 return std::ldexp(static_cast<double>(negative ? -number : number), exponent);
237 } 237 }
238 238
239 239
240 template <class Iterator, class EndMark> 240 template <class Iterator, class EndMark>
241 double InternalStringToInt(UnicodeCache* unicode_cache, 241 double InternalStringToInt(UnicodeCache* unicode_cache,
242 Iterator current, 242 Iterator current,
243 EndMark end, 243 EndMark end,
244 int radix) { 244 int radix) {
245 const bool allow_trailing_junk = true; 245 const bool allow_trailing_junk = true;
246 const double empty_string_val = JunkStringValue(); 246 const double empty_string_val = JunkStringValue();
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 SLOW_ASSERT(buffer_pos < kBufferSize); 695 SLOW_ASSERT(buffer_pos < kBufferSize);
696 buffer[buffer_pos] = '\0'; 696 buffer[buffer_pos] = '\0';
697 697
698 double converted = Strtod(Vector<const char>(buffer, buffer_pos), exponent); 698 double converted = Strtod(Vector<const char>(buffer, buffer_pos), exponent);
699 return (sign == NEGATIVE) ? -converted : converted; 699 return (sign == NEGATIVE) ? -converted : converted;
700 } 700 }
701 701
702 } } // namespace v8::internal 702 } } // namespace v8::internal
703 703
704 #endif // V8_CONVERSIONS_INL_H_ 704 #endif // V8_CONVERSIONS_INL_H_
OLDNEW
« no previous file with comments | « src/conversions.cc ('k') | src/cpu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698