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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
293 } | 293 } |
294 | 294 |
295 | 295 |
296 DEFINE_NATIVE_ENTRY(Double_getIsNegative, 1) { | 296 DEFINE_NATIVE_ENTRY(Double_getIsNegative, 1) { |
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 | |
304 DEFINE_NATIVE_ENTRY(Double_flipSignBit, 1) { | |
305 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); | |
306 const double in_val = arg.value(); | |
307 const int64_t bits = | |
308 *(reinterpret_cast<const int64_t*>(&in_val)) ^ 0x8000000000000000LL; | |
koda
2015/06/02 23:41:02
Consider putting the constant in globals.h. Also,
koda
2015/06/02 23:41:02
Just curious: I wonder if there is any spec/de-fac
srdjan
2015/06/03 00:02:51
AFAIK yes, we are using it in simd28.cc and assemb
srdjan
2015/06/03 00:02:51
As far as I remember, I had problems with doing it
| |
309 const double out_val = *(reinterpret_cast<const double*>(&bits)); | |
310 return Double::New(out_val); | |
311 } | |
312 | |
303 // Add here only functions using/referring to old-style casts. | 313 // Add here only functions using/referring to old-style casts. |
304 | 314 |
305 } // namespace dart | 315 } // namespace dart |
OLD | NEW |