| 1 |
// Copyright 2009 the Sputnik authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
info: If result is greater than or equal to 2^31, return result -2^32 |
| 6 |
es5id: 9.5_A2.3_T2 |
| 7 |
description: Use operator ~ |
| 8 |
---*/ |
| 9 |
|
| 10 |
// CHECK#1 |
| 11 |
if (~2147483647 !== -2147483648) { |
| 12 |
$ERROR('#1: ~2147483647 ==== -2147483648)'); |
| 13 |
} |
| 14 |
|
| 15 |
// CHECK#2 |
| 16 |
if (~2147483648 !== ~-2147483648) { |
| 17 |
$ERROR('#2: ~2147483648 ==== ~-2147483648)'); |
| 18 |
} |
| 19 |
|
| 20 |
// CHECK#3 |
| 21 |
if (~2147483649 !== ~-2147483647) { |
| 22 |
$ERROR('#3: ~2147483649 ==== ~-2147483647)'); |
| 23 |
} |
| 24 |
|
| 25 |
// CHECK#4 |
| 26 |
if (~4294967295 !== ~-1) { |
| 27 |
$ERROR('#4: ~4294967295 ==== ~-1)'); |
| 28 |
} |
| 29 |
|
| 30 |
// CHECK#5 |
| 31 |
if (~4294967296 !== ~0) { |
| 32 |
$ERROR('#5: ~4294967296 ==== ~0)'); |
| 33 |
} |
| 34 |
|
| 35 |
// CHECK#6 |
| 36 |
if (~4294967297 !== ~1) { |
| 37 |
$ERROR('#6: ~4294967297 ==== ~1)'); |
| 38 |
} |