OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // Dart test program for testing left shifts of a constant. | 5 // Dart test program for testing left shifts of a constant. |
6 | 6 |
7 import "package:expect/expect.dart"; | |
8 | |
9 shiftLeft0(c) => 0 << c; | 7 shiftLeft0(c) => 0 << c; |
10 shiftLeft1(c) => 1 << c; | 8 shiftLeft1(c) => 1 << c; |
11 shiftLeft8448(c) => 8448 << c; | 9 shiftLeft8448(c) => 8448 << c; |
12 | 10 |
13 shiftLeftNeg1(c) => -1 << c; | 11 shiftLeftNeg1(c) => -1 << c; |
14 shiftLeftNeg8448(c) => -8448 << c; | 12 shiftLeftNeg8448(c) => -8448 << c; |
15 | 13 |
16 main() { | 14 main() { |
17 // Optimize shifts. | 15 // Optimize shifts. |
18 for (int i = 0; i < 6000; i++) { | 16 for (int i = 0; i < 6000; i++) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // Deoptimize on 32-bit. | 69 // Deoptimize on 32-bit. |
72 Expect.equals(-1107296256, shiftLeftNeg8448(17)); | 70 Expect.equals(-1107296256, shiftLeftNeg8448(17)); |
73 Expect.equals(-2214592512, shiftLeftNeg8448(18)); | 71 Expect.equals(-2214592512, shiftLeftNeg8448(18)); |
74 Expect.equals(-1188950301625810944, shiftLeftNeg8448(47)); | 72 Expect.equals(-1188950301625810944, shiftLeftNeg8448(47)); |
75 Expect.equals(-2377900603251621888, shiftLeftNeg8448(48)); | 73 Expect.equals(-2377900603251621888, shiftLeftNeg8448(48)); |
76 // Deoptimize on 64 bits. | 74 // Deoptimize on 64 bits. |
77 Expect.equals(-4755801206503243776, shiftLeftNeg8448(49)); | 75 Expect.equals(-4755801206503243776, shiftLeftNeg8448(49)); |
78 Expect.equals(-9511602413006487552, shiftLeftNeg8448(50)); | 76 Expect.equals(-9511602413006487552, shiftLeftNeg8448(50)); |
79 } | 77 } |
80 | 78 |
OLD | NEW |