Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: tests/language/vm/unaligned_float_access_register_index_test.dart

Issue 2473553002: Fix unaligned access to TypedData from native code. (Closed)
Patch Set: . Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4 // VMOptions=--optimization_counter_threshold=10 --no-background_compilation
5
6 import 'dart:typed_data';
7 import 'package:expect/expect.dart';
8
9 unalignedFloat32() {
10 var bytes = new ByteData(64);
11 for (var i = 0; i < 4; i++) {
12 bytes.setFloat32(i, 16.25);
13 Expect.equals(16.25, bytes.getFloat32(i));
14 }
15 }
16
17 unalignedFloat64() {
18 var bytes = new ByteData(64);
19 for (var i = 0; i < 8; i++) {
20 bytes.setFloat64(i, 16.25);
21 Expect.equals(16.25, bytes.getFloat64(i));
22 }
23 }
24
25 main() {
26 for (var i = 0; i < 20; i++) {
27 unalignedFloat32();
28 unalignedFloat64();
29 }
30 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698