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

Side by Side Diff: src/double.h

Issue 553843002: Replace our home-grown BitCast with bit_cast from Chrome/Google3. (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
« no previous file with comments | « src/deoptimizer.cc ('k') | src/factory.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 // 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 #ifndef V8_DOUBLE_H_ 5 #ifndef V8_DOUBLE_H_
6 #define V8_DOUBLE_H_ 6 #define V8_DOUBLE_H_
7 7
8 #include "src/diy-fp.h" 8 #include "src/diy-fp.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 12
13 // We assume that doubles and uint64_t have the same endianness. 13 // We assume that doubles and uint64_t have the same endianness.
14 inline uint64_t double_to_uint64(double d) { return BitCast<uint64_t>(d); } 14 inline uint64_t double_to_uint64(double d) { return bit_cast<uint64_t>(d); }
15 inline double uint64_to_double(uint64_t d64) { return BitCast<double>(d64); } 15 inline double uint64_to_double(uint64_t d64) { return bit_cast<double>(d64); }
16 16
17 // Helper functions for doubles. 17 // Helper functions for doubles.
18 class Double { 18 class Double {
19 public: 19 public:
20 static const uint64_t kSignMask = V8_2PART_UINT64_C(0x80000000, 00000000); 20 static const uint64_t kSignMask = V8_2PART_UINT64_C(0x80000000, 00000000);
21 static const uint64_t kExponentMask = V8_2PART_UINT64_C(0x7FF00000, 00000000); 21 static const uint64_t kExponentMask = V8_2PART_UINT64_C(0x7FF00000, 00000000);
22 static const uint64_t kSignificandMask = 22 static const uint64_t kSignificandMask =
23 V8_2PART_UINT64_C(0x000FFFFF, FFFFFFFF); 23 V8_2PART_UINT64_C(0x000FFFFF, FFFFFFFF);
24 static const uint64_t kHiddenBit = V8_2PART_UINT64_C(0x00100000, 00000000); 24 static const uint64_t kHiddenBit = V8_2PART_UINT64_C(0x00100000, 00000000);
25 static const int kPhysicalSignificandSize = 52; // Excludes the hidden bit. 25 static const int kPhysicalSignificandSize = 52; // Excludes the hidden bit.
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 biased_exponent = static_cast<uint64_t>(exponent + kExponentBias); 200 biased_exponent = static_cast<uint64_t>(exponent + kExponentBias);
201 } 201 }
202 return (significand & kSignificandMask) | 202 return (significand & kSignificandMask) |
203 (biased_exponent << kPhysicalSignificandSize); 203 (biased_exponent << kPhysicalSignificandSize);
204 } 204 }
205 }; 205 };
206 206
207 } } // namespace v8::internal 207 } } // namespace v8::internal
208 208
209 #endif // V8_DOUBLE_H_ 209 #endif // V8_DOUBLE_H_
OLDNEW
« no previous file with comments | « src/deoptimizer.cc ('k') | src/factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698