Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
test/libsolidity/semanticTests/various/bin_number_literal_arithmetics_basic.sol
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,40 @@ | ||
contract test { | ||
function add(uint a, uint b) public pure returns (uint c) { | ||
c = a + b; | ||
} | ||
function sub(uint a, uint b) public pure returns (uint c) { | ||
c = a - b; | ||
} | ||
function mul(uint a, uint b) public pure returns (uint c) { | ||
c = a * b; | ||
} | ||
function div(uint a, uint b) public pure returns (uint c) { | ||
c = a / b; | ||
} | ||
function mod(uint a, uint b) public pure returns (uint c) { | ||
c = a % b; | ||
} | ||
function inc(uint a) public pure returns (uint b) { | ||
b = ++a; | ||
} | ||
function dec(uint a) public pure returns (uint b) { | ||
b = --a; | ||
} | ||
} | ||
// ---- | ||
// add(uint256,uint256): 0b1100, 0b0011 -> 0b1111 | ||
// add(uint256,uint256): 0b11101010111101110, 0b100011111011000100011011000 -> 0b100011111110101111011000110 | ||
// add(uint256,uint256): 0b100010101110110000111000, 0b101101011010000 -> 0b100010110100011100001000 | ||
// add(uint256,uint256): 0b11111, 0b1 -> 0b100000 | ||
// sub(uint256,uint256): 0b10000110000101011, 0b1111010100000101 -> 0b1011100100110 | ||
// sub(uint256,uint256): 0b11101100111100001, 0b1011000010001101 -> 0b10010100101010100 | ||
// sub(uint256,uint256): 0b11111, 0b11110 -> 0b1 | ||
// sub(uint256,uint256): 0b1000, 0b1 -> 0b111 | ||
// mul(uint256,uint256): 0b10101, 0b010101 -> 0b110111001 | ||
// mul(uint256,uint256): 0b0, 0b1010011 -> 0b0 | ||
// mul(uint256,uint256): 0b111111000000, 0b11000001101010 -> 0b10111110101000010110000000 | ||
// div(uint256,uint256): 0b11100100101100110100010101, 0b10101011110010001011110 -> 0b1010 | ||
// div(uint256,uint256): 0b1000010110000011011100100, 0b10101101100011001011000 -> 0b11 | ||
// div(uint256,uint256): 0b1011, 0b11111 -> 0 | ||
|
||
|