OLD | NEW |
| (Empty) |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 import "package:expect/expect.dart"; | |
6 | |
7 // The "if (negative) res2 |= 3" below can be emitted as negative && (res2 |= 3) | |
8 // in JavaScript. Dart2js produced the wrong output. | |
9 | |
10 _shiftRight(x, y) => x; | |
11 int64_bits(x) => x; | |
12 | |
13 class A { | |
14 opshr(int n, a2) { | |
15 int res2; | |
16 bool negative = a2 == 496; | |
17 | |
18 res2 = _shiftRight(a2, n); | |
19 if (negative) { | |
20 res2 |= 3; | |
21 } | |
22 return int64_bits(res2); | |
23 } | |
24 } | |
25 | |
26 main() { | |
27 var a = new A(); | |
28 var t; | |
29 for (int i = 0; i < 3; i++) { | |
30 t = a.opshr(99, 496); | |
31 } | |
32 Expect.equals(499, t); | |
33 } | |
OLD | NEW |