OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/bootstrap_natives.h" | 5 #include "vm/bootstrap_natives.h" |
6 | 6 |
7 #include "platform/math.h" | 7 #include "platform/math.h" |
8 | 8 |
9 #include "vm/code_generator.h" // DartModulo. | 9 #include "vm/code_generator.h" // DartModulo. |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); | 297 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); |
298 // Include negative zero, infinity. | 298 // Include negative zero, infinity. |
299 double dval = arg.value(); | 299 double dval = arg.value(); |
300 return Bool::Get(signbit(dval) && !isnan(dval)).raw(); | 300 return Bool::Get(signbit(dval) && !isnan(dval)).raw(); |
301 } | 301 } |
302 | 302 |
303 | 303 |
304 DEFINE_NATIVE_ENTRY(Double_flipSignBit, 1) { | 304 DEFINE_NATIVE_ENTRY(Double_flipSignBit, 1) { |
305 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); | 305 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); |
306 const double in_val = arg.value(); | 306 const double in_val = arg.value(); |
307 // TODO(srdjan): Fix this compilation error. | 307 const int64_t bits = bit_cast<int64_t, double>(in_val) ^ kSignBitDouble; |
308 // const int64_t bits = | 308 return Double::New(bit_cast<double, int64_t>(bits)); |
309 // *(reinterpret_cast<const int64_t*>(&in_val)) ^ kSignBitDouble; | |
310 // const double out_val = *(reinterpret_cast<const double*>(&bits)); | |
311 // return Double::New(out_val); | |
312 return Double::New(-in_val); | |
313 } | 309 } |
314 | 310 |
315 // Add here only functions using/referring to old-style casts. | 311 // Add here only functions using/referring to old-style casts. |
316 | 312 |
317 } // namespace dart | 313 } // namespace dart |
OLD | NEW |