-
Notifications
You must be signed in to change notification settings - Fork 54
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
28 changed files
with
950 additions
and
381 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
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
18 changes: 18 additions & 0 deletions
18
integration_tests/builtin_tests/bitwise_builtin_test.cairo
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,18 @@ | ||
%builtins bitwise | ||
from starkware.cairo.common.bitwise import bitwise_and, bitwise_xor, bitwise_or, bitwise_operations | ||
from starkware.cairo.common.cairo_builtins import BitwiseBuiltin | ||
|
||
func main{bitwise_ptr: BitwiseBuiltin*}() { | ||
let (and_a) = bitwise_and(12, 10); // Binary (1100, 1010). | ||
assert and_a = 8; // Binary 1000. | ||
let (xor_a) = bitwise_xor(12, 10); | ||
assert xor_a = 6; | ||
let (or_a) = bitwise_or(12, 10); | ||
assert or_a = 14; | ||
|
||
let (and_b, xor_b, or_b) = bitwise_operations(9, 3); | ||
assert and_b = 1; | ||
assert xor_b = 10; | ||
assert or_b = 11; | ||
return (); | ||
} |
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,11 @@ | ||
%builtins output pedersen range_check | ||
|
||
from starkware.cairo.common.cairo_builtins import HashBuiltin | ||
from starkware.cairo.common.hash import hash2 | ||
|
||
func main{output_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}() { | ||
let (seed) = hash2{hash_ptr=pedersen_ptr}(0, 0); | ||
assert [output_ptr] = seed; | ||
let output_ptr = output_ptr + 1; | ||
return (); | ||
} |
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,6 @@ | ||
%builtins range_check | ||
|
||
func main(range_check_ptr: felt) -> (range_check_ptr: felt) { | ||
assert [range_check_ptr] = -1; | ||
return (range_check_ptr=range_check_ptr + 1); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package hintrunner | ||
|
||
import "github.com/holiman/uint256" | ||
|
||
func MaxU128() uint256.Int { | ||
return uint256.Int{18446744073709551615, 18446744073709551615, 0, 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
Oops, something went wrong.