| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 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 | 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 // Test UnboxedIntConverter for int32. | 4 // Test UnboxedIntConverter for int32. |
| 5 // VMOptions=--optimization-counter-threshold=10 --no-use-osr | 5 // VMOptions=--optimization-counter-threshold=10 --no-use-osr --no-background-co
mpilation |
| 6 | 6 |
| 7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
| 8 import "dart:typed_data"; | 8 import "dart:typed_data"; |
| 9 | 9 |
| 10 int32_add(a, b, c) => (a * c) + (b * c); | 10 int32_add(a, b, c) => (a * c) + (b * c); |
| 11 int32_mul(a, b, c) => (a * c) * b; | 11 int32_mul(a, b, c) => (a * c) * b; |
| 12 int32_sub(a, b, c) => (a * c) - (b * c); | 12 int32_sub(a, b, c) => (a * c) - (b * c); |
| 13 int32_shr(a, b, c) => (a * c * b) >> 16; | 13 int32_shr(a, b, c) => (a * c * b) >> 16; |
| 14 int32_shl(a, b, c) => (a * c * b) << 16; | 14 int32_shl(a, b, c) => (a * c * b) << 16; |
| 15 int32_xor(a, b, c) => (a * c) ^ (b * c); | 15 int32_xor(a, b, c) => (a * c) ^ (b * c); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 Expect.equals(0, int32_shr(1, 1, 1)); | 70 Expect.equals(0, int32_shr(1, 1, 1)); |
| 71 Expect.equals(1 << 16, int32_shl(1, 1, 1)); | 71 Expect.equals(1 << 16, int32_shl(1, 1, 1)); |
| 72 | 72 |
| 73 for (var j = 0; j < 1000; j++) { | 73 for (var j = 0; j < 1000; j++) { |
| 74 Expect.equals(4294839503, int32_to_mint(0, 1000)); | 74 Expect.equals(4294839503, int32_to_mint(0, 1000)); |
| 75 Expect.equals(-8, mint_to_int32(2, 0x100000000, 0x100000001)); | 75 Expect.equals(-8, mint_to_int32(2, 0x100000000, 0x100000001)); |
| 76 Expect.equals(8, uint32_to_int32(2, 0x100000001)); | 76 Expect.equals(8, uint32_to_int32(2, 0x100000001)); |
| 77 } | 77 } |
| 78 Expect.equals(8 * 0x80000001, uint32_to_int32(2, 0x180000001)); | 78 Expect.equals(8 * 0x80000001, uint32_to_int32(2, 0x180000001)); |
| 79 } | 79 } |
| OLD | NEW |