forked from ton-blockchain/ton
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FunC] Fix a bug with << operator to zero value (ton-blockchain#1262)
- Loading branch information
Showing
3 changed files
with
56 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
|
||
int lshift() { | ||
return (1 << 0) == 1; | ||
} | ||
|
||
int rshift() { | ||
return (1 >> 0) == 1; | ||
} | ||
|
||
int lshift_var(int i) { | ||
return (1 << i) == 1; | ||
} | ||
|
||
int rshift_var(int i) { | ||
return (1 >> i) == 1; | ||
} | ||
|
||
int main(int x) { | ||
if (x == 0) { | ||
return lshift(); | ||
} elseif (x == 1) { | ||
return rshift(); | ||
} elseif (x == 2) { | ||
return lshift_var(0); | ||
} elseif (x == 3) { | ||
return rshift_var(0); | ||
} elseif (x == 4) { | ||
return lshift_var(1); | ||
} else { | ||
return rshift_var(1); | ||
} | ||
} | ||
|
||
int is_claimed(int index) method_id(11) { | ||
int claim_bit_index = index % 256; | ||
int mask = 1 << claim_bit_index; | ||
return (255 & mask) == mask; | ||
} | ||
|
||
|
||
{- | ||
method_id | in | out | ||
TESTCASE | 0 | 0 | -1 | ||
TESTCASE | 0 | 1 | -1 | ||
TESTCASE | 0 | 2 | -1 | ||
TESTCASE | 0 | 3 | -1 | ||
TESTCASE | 0 | 4 | 0 | ||
TESTCASE | 0 | 5 | 0 | ||
TESTCASE | 11 | 0 | -1 | ||
TESTCASE | 11 | 1 | -1 | ||
TESTCASE | 11 | 256 | -1 | ||
TESTCASE | 11 | 8 | 0 | ||
-} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters