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

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

Issue 11644097: Use C++ style type casts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/simulator-arm.cc ('k') | src/heap-inl.h » ('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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 number++; // Rounding up. 205 number++; // Rounding up.
206 } else if (dropped_bits == middle_value) { 206 } else if (dropped_bits == middle_value) {
207 // Rounding to even to consistency with decimals: half-way case rounds 207 // Rounding to even to consistency with decimals: half-way case rounds
208 // up if significant part is odd and down otherwise. 208 // up if significant part is odd and down otherwise.
209 if ((number & 1) != 0 || !zero_tail) { 209 if ((number & 1) != 0 || !zero_tail) {
210 number++; // Rounding up. 210 number++; // Rounding up.
211 } 211 }
212 } 212 }
213 213
214 // Rounding up may cause overflow. 214 // Rounding up may cause overflow.
215 if ((number & ((int64_t)1 << 53)) != 0) { 215 if ((number & (static_cast<int64_t>(1) << 53)) != 0) {
216 exponent++; 216 exponent++;
217 number >>= 1; 217 number >>= 1;
218 } 218 }
219 break; 219 break;
220 } 220 }
221 ++current; 221 ++current;
222 } while (current != end); 222 } while (current != end);
223 223
224 ASSERT(number < ((int64_t)1 << 53)); 224 ASSERT(number < ((int64_t)1 << 53));
225 ASSERT(static_cast<int64_t>(static_cast<double>(number)) == number); 225 ASSERT(static_cast<int64_t>(static_cast<double>(number)) == number);
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 ASSERT(buffer_pos < kBufferSize); 669 ASSERT(buffer_pos < kBufferSize);
670 buffer[buffer_pos] = '\0'; 670 buffer[buffer_pos] = '\0';
671 671
672 double converted = Strtod(Vector<const char>(buffer, buffer_pos), exponent); 672 double converted = Strtod(Vector<const char>(buffer, buffer_pos), exponent);
673 return (sign == NEGATIVE) ? -converted : converted; 673 return (sign == NEGATIVE) ? -converted : converted;
674 } 674 }
675 675
676 } } // namespace v8::internal 676 } } // namespace v8::internal
677 677
678 #endif // V8_CONVERSIONS_INL_H_ 678 #endif // V8_CONVERSIONS_INL_H_
OLDNEW
« no previous file with comments | « src/arm/simulator-arm.cc ('k') | src/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698