cairo-native 0.9.0-rc.4

A compiler to convert Cairo's IR Sierra code to MLIR and execute it.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use zeroable::IsZeroResult;

extern fn u32_is_zero(a: u32) -> IsZeroResult<u32> implicits() nopanic;

use traits::TryInto;
use core::option::OptionTrait;

fn program(value: u32) -> bool {
    match u32_is_zero(value) {
        IsZeroResult::Zero(_) => true,
        IsZeroResult::NonZero(_) => false,
    }
}

fn run_test(value: felt252) -> bool {
    program(value.try_into().unwrap())
}