| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 // VMOptions=--optimization_counter_threshold=10 --no-background_compilation | 4 // VMOptions=--optimization_counter_threshold=10 --no-background_compilation |
| 5 | 5 |
| 6 import 'dart:typed_data'; | 6 import 'dart:typed_data'; |
| 7 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
| 8 | 8 |
| 9 unalignedUint16() { | 9 unalignedUint16() { |
| 10 var bytes = new ByteData(64); | 10 var bytes = new ByteData(64); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 } | 47 } |
| 48 | 48 |
| 49 unalignedInt64() { | 49 unalignedInt64() { |
| 50 var bytes = new ByteData(64); | 50 var bytes = new ByteData(64); |
| 51 for (var i = 0; i < 8; i++) { | 51 for (var i = 0; i < 8; i++) { |
| 52 bytes.setInt64(i, -0x12341234); | 52 bytes.setInt64(i, -0x12341234); |
| 53 Expect.equals(-0x12341234, bytes.getInt64(i)); | 53 Expect.equals(-0x12341234, bytes.getInt64(i)); |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 | 56 |
| 57 unalignedFloat32() { | |
| 58 var bytes = new ByteData(64); | |
| 59 for (var i = 0; i < 4; i++) { | |
| 60 bytes.setFloat32(i, 16.25); | |
| 61 Expect.equals(16.25, bytes.getFloat32(i)); | |
| 62 } | |
| 63 } | |
| 64 | |
| 65 unalignedFloat64() { | |
| 66 var bytes = new ByteData(64); | |
| 67 for (var i = 0; i < 8; i++) { | |
| 68 bytes.setFloat64(i, 16.25); | |
| 69 Expect.equals(16.25, bytes.getFloat64(i)); | |
| 70 } | |
| 71 } | |
| 72 | |
| 73 main() { | 57 main() { |
| 74 for (var i = 0; i < 20; i++) { | 58 for (var i = 0; i < 20; i++) { |
| 75 unalignedUint16(); | 59 unalignedUint16(); |
| 76 unalignedInt16(); | 60 unalignedInt16(); |
| 77 unalignedUint32(); | 61 unalignedUint32(); |
| 78 unalignedInt32(); | 62 unalignedInt32(); |
| 79 unalignedUint64(); | 63 unalignedUint64(); |
| 80 unalignedInt64(); | 64 unalignedInt64(); |
| 81 unalignedFloat32(); | |
| 82 unalignedFloat64(); | |
| 83 } | 65 } |
| 84 } | 66 } |
| OLD | NEW |