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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 return Double::New(ceil(arg.value())); | 191 return Double::New(ceil(arg.value())); |
192 } | 192 } |
193 | 193 |
194 | 194 |
195 DEFINE_NATIVE_ENTRY(Double_truncate, 1) { | 195 DEFINE_NATIVE_ENTRY(Double_truncate, 1) { |
196 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); | 196 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); |
197 return Double::New(trunc(arg.value())); | 197 return Double::New(trunc(arg.value())); |
198 } | 198 } |
199 | 199 |
200 | 200 |
201 #if defined(TARGET_OS_MACOS) | 201 #if defined(HOST_OS_MACOS) |
202 // MAC OSX math library produces old style cast warning. | 202 // MAC OSX math library produces old style cast warning. |
203 #pragma GCC diagnostic ignored "-Wold-style-cast" | 203 #pragma GCC diagnostic ignored "-Wold-style-cast" |
204 #endif | 204 #endif |
205 | 205 |
206 DEFINE_NATIVE_ENTRY(Double_toInt, 1) { | 206 DEFINE_NATIVE_ENTRY(Double_toInt, 1) { |
207 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); | 207 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); |
208 return DoubleToInteger(arg.value(), "Infinity or NaN toInt"); | 208 return DoubleToInteger(arg.value(), "Infinity or NaN toInt"); |
209 } | 209 } |
210 | 210 |
211 | 211 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 DEFINE_NATIVE_ENTRY(Double_flipSignBit, 1) { | 309 DEFINE_NATIVE_ENTRY(Double_flipSignBit, 1) { |
310 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); | 310 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); |
311 const double in_val = arg.value(); | 311 const double in_val = arg.value(); |
312 const int64_t bits = bit_cast<int64_t, double>(in_val) ^ kSignBitDouble; | 312 const int64_t bits = bit_cast<int64_t, double>(in_val) ^ kSignBitDouble; |
313 return Double::New(bit_cast<double, int64_t>(bits)); | 313 return Double::New(bit_cast<double, int64_t>(bits)); |
314 } | 314 } |
315 | 315 |
316 // Add here only functions using/referring to old-style casts. | 316 // Add here only functions using/referring to old-style casts. |
317 | 317 |
318 } // namespace dart | 318 } // namespace dart |
OLD | NEW |