Skip to content

Commit

Permalink
Add exit_check to shift example
Browse files Browse the repository at this point in the history
  • Loading branch information
makxenov authored and nkaskov committed Jan 5, 2024
1 parent 7b4b365 commit b3f5f97
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
10 changes: 5 additions & 5 deletions examples/cpp/bit_operations/shift_left.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <cstdint>

[[circuit]] uint32_t shl(uint32_t a,
uint32_t b) {


return a << b; // shl
[[circuit]] uint64_t shl(uint64_t value, uint64_t shift, uint64_t expected_shifted)
{
uint64_t shifted = value << shift;
__builtin_assigner_exit_check(shifted == expected_shifted);
return shifted;
}
7 changes: 4 additions & 3 deletions examples/inputs/bit_operations/shift_left.inp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[
{"int": 11},
{"int": 2}
]
{"int": 1},
{"int": 2},
{"int": 4}
]
2 changes: 1 addition & 1 deletion libs/assigner

0 comments on commit b3f5f97

Please sign in to comment.