OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "vm/exceptions.h" | 7 #include "vm/exceptions.h" |
8 #include "vm/native_entry.h" | 8 #include "vm/native_entry.h" |
9 #include "vm/object.h" | 9 #include "vm/object.h" |
10 #include "vm/symbols.h" | 10 #include "vm/symbols.h" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 return Double::New(value); | 228 return Double::New(value); |
229 } | 229 } |
230 | 230 |
231 | 231 |
232 DEFINE_NATIVE_ENTRY(Float32x4_shuffle, 2) { | 232 DEFINE_NATIVE_ENTRY(Float32x4_shuffle, 2) { |
233 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); | 233 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); |
234 GET_NON_NULL_NATIVE_ARGUMENT(Integer, mask, arguments->NativeArgAt(1)); | 234 GET_NON_NULL_NATIVE_ARGUMENT(Integer, mask, arguments->NativeArgAt(1)); |
235 int64_t m = mask.AsInt64Value(); | 235 int64_t m = mask.AsInt64Value(); |
236 if (m < 0 || m > 255) { | 236 if (m < 0 || m > 255) { |
237 const String& error = String::Handle( | 237 const String& error = String::Handle( |
238 String::NewFormatted("mask (%"Pd64") must be in the range [0..256)", m)); | 238 String::NewFormatted("mask (%" Pd64 ") must be in the range [0..256)", |
| 239 m)); |
239 const Array& args = Array::Handle(Array::New(1)); | 240 const Array& args = Array::Handle(Array::New(1)); |
240 args.SetAt(0, error); | 241 args.SetAt(0, error); |
241 Exceptions::ThrowByType(Exceptions::kRange, args); | 242 Exceptions::ThrowByType(Exceptions::kRange, args); |
242 } | 243 } |
243 float data[4] = { self.x(), self.y(), self.z(), self.w() }; | 244 float data[4] = { self.x(), self.y(), self.z(), self.w() }; |
244 float _x = data[m & 0x3]; | 245 float _x = data[m & 0x3]; |
245 float _y = data[(m >> 2) & 0x3]; | 246 float _y = data[(m >> 2) & 0x3]; |
246 float _z = data[(m >> 4) & 0x3]; | 247 float _z = data[(m >> 4) & 0x3]; |
247 float _w = data[(m >> 6) & 0x3]; | 248 float _w = data[(m >> 6) & 0x3]; |
248 return Float32x4::New(_x, _y, _z, _w); | 249 return Float32x4::New(_x, _y, _z, _w); |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 } | 682 } |
682 | 683 |
683 | 684 |
684 DEFINE_NATIVE_ENTRY(Uint32x4_toFloat32x4, 1) { | 685 DEFINE_NATIVE_ENTRY(Uint32x4_toFloat32x4, 1) { |
685 GET_NON_NULL_NATIVE_ARGUMENT(Uint32x4, v, arguments->NativeArgAt(0)); | 686 GET_NON_NULL_NATIVE_ARGUMENT(Uint32x4, v, arguments->NativeArgAt(0)); |
686 return Float32x4::New(v.value()); | 687 return Float32x4::New(v.value()); |
687 } | 688 } |
688 | 689 |
689 | 690 |
690 } // namespace dart | 691 } // namespace dart |
OLD | NEW |