12 lines
No EOL
358 B
Text
12 lines
No EOL
358 B
Text
from "EMBED" import field_to_bool_unsafe;
|
|
|
|
def main(field x) -> bool {
|
|
// we constrain `x` to be 0 or 1
|
|
asm {
|
|
x * (x - 1) === 0;
|
|
}
|
|
// we can treat `x` as `bool` afterwards, as we constrained it properly
|
|
// `field_to_bool_unsafe` call does not produce any extra constraints
|
|
bool out = field_to_bool_unsafe(x);
|
|
return out;
|
|
} |