Skip to content

Commit

Permalink
Add Sint16 type + libfuncs (#382)
Browse files Browse the repository at this point in the history
* Push progress

* Parse Sint8 result value

* Improve sub test + fix how signed values are compared against vm values

* Clippy

* Improve testing

* Fix

* Try stuff

* Fix typos

* Fix test values

* Add test & fix wide_mul

* First draft of diff libfunc

* Improve test

* Remove old code

* Add test

* Add Sint16 type + libfuncs

* fmt

* Remove uneeded intermidiate variables

* Update code
  • Loading branch information
fmoletta authored Dec 14, 2023
1 parent f127985 commit ceaf227
Show file tree
Hide file tree
Showing 14 changed files with 1,043 additions and 6 deletions.
12 changes: 11 additions & 1 deletion src/jit_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,17 @@ pub fn execute(

params_ptrs.push(next.to_jit(&arena, registry, param_type_id)?);
}
CoreTypeConcrete::Sint16(_) => todo!(),
CoreTypeConcrete::Sint16(_) => {
let next = params_it
.next()
.ok_or_else(|| make_missing_parameter(param_type_id))?;

if !matches!(next, JITValue::Sint16(_)) {
Err(make_unexpected_value_error("JITValue::Sint16".to_string()))?;
}

params_ptrs.push(next.to_jit(&arena, registry, param_type_id)?);
}
CoreTypeConcrete::Sint32(_) => todo!(),
CoreTypeConcrete::Sint64(_) => todo!(),
CoreTypeConcrete::Sint128(_) => todo!(),
Expand Down
5 changes: 4 additions & 1 deletion src/libfuncs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ pub mod mem;
pub mod nullable;
pub mod pedersen;
pub mod poseidon;
pub mod sint16;
pub mod sint8;
pub mod snapshot_take;
pub mod stark_net;
Expand Down Expand Up @@ -203,7 +204,9 @@ where
Self::Sint8(info) => {
self::sint8::build(context, registry, entry, location, helper, metadata, info)
}
CoreConcreteLibfunc::Sint16(_) => todo!(),
CoreConcreteLibfunc::Sint16(info) => {
self::sint16::build(context, registry, entry, location, helper, metadata, info)
}
CoreConcreteLibfunc::Sint32(_) => todo!(),
CoreConcreteLibfunc::Sint64(_) => todo!(),
CoreConcreteLibfunc::Sint128(_) => todo!(),
Expand Down
Loading

0 comments on commit ceaf227

Please sign in to comment.