OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2014, 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 // | |
5 // Dart Mint representations and type propagation issue. | |
6 // | |
7 // VMOptions=--optimization-counter-threshold=5 --no-use-osr | |
8 | |
9 import 'dart:typed_data'; | |
10 import "package:expect/expect.dart"; | |
11 | |
12 main() { | |
13 var a = new Uint32List(100); | |
14 a[2] = 3; | |
15 var res = sumIt1(a, 2); | |
16 Expect.equals(3 * 10, res); | |
17 res = sumIt1(a, 2); | |
18 Expect.equals(3 * 10, res); | |
19 a = new Int32List(100); | |
hausner
2014/07/24 21:05:45
I guess except for you, nobody would know why you
srdjan
2014/07/24 21:26:58
Adding comment: test Uint32List and Int32List load
| |
20 a[2] = 3; | |
21 res = sumIt2(a, 2); | |
22 Expect.equals(3 * 10, res); | |
23 res = sumIt2(a, 2); | |
24 Expect.equals(3 * 10, res); | |
25 | |
hausner
2014/07/24 21:05:45
Nit: comply with 2011 Blank Line Conservation Act
srdjan
2014/07/24 21:26:58
Hmm, somehow the latest (and space conserving) CL
| |
26 } | |
27 | |
28 | |
29 | |
30 sumIt1(Uint32List a, int n) { | |
31 var sum = 0; | |
32 for (int i = 0; i < 10; i++) { | |
33 sum += a[n]; | |
34 } | |
35 return sum; | |
36 } | |
37 | |
38 sumIt2(Int32List a, int n) { | |
39 var sum = 0; | |
40 for (int i = 0; i < 10; i++) { | |
41 sum += a[n]; | |
42 } | |
43 return sum; | |
44 } | |
OLD | NEW |