-
Notifications
You must be signed in to change notification settings - Fork 44
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
3 changed files
with
44 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include <stddef.h> | ||
#include <stdint.h> | ||
#include <stdio.h> | ||
|
||
|
||
typedef struct fib_return_values | ||
{ | ||
unsigned __int128 remaining_gas; | ||
struct { | ||
uint8_t discriminant; | ||
union { | ||
uint64_t ok[4]; | ||
struct { | ||
void *ptr; | ||
uint32_t len; | ||
uint32_t cap; | ||
} err; | ||
}; | ||
} result; | ||
} fib_return_values_t; | ||
|
||
|
||
static void run_bench(fib_return_values_t *, void *, uint64_t) | ||
__attribute__((weakref("_mlir_ciface_fib_1m::fib_1m::main"))); | ||
|
||
|
||
int main() | ||
{ | ||
fib_return_values_t return_values; | ||
|
||
run_bench(&return_values, NULL, 0); | ||
|
||
return return_values.result.discriminant; | ||
} |
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,10 @@ | ||
fn fib(a: felt252, b: felt252, n: felt252) -> felt252 { | ||
match n { | ||
0 => a, | ||
_ => fib(b, a + b, n - 1), | ||
} | ||
} | ||
|
||
fn main() -> felt252 { | ||
fib(0, 1, 1000000) | ||
} |
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