OLD | NEW |
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 "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 BitCast<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 BitCast<double>(d64); } |
16 | 16 |
17 // Helper functions for doubles. | 17 // Helper functions for doubles. |
18 class Double { | 18 class Double { |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_ |
OLD | NEW |