Skip to content

Commit

Permalink
Avoid heap allocation
Browse files Browse the repository at this point in the history
Co-authored-by: Yoshitomo Nakanishi <[email protected]>
  • Loading branch information
k0aki and Y-Nak authored Sep 30, 2023
1 parent 8826784 commit 1b8de20
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/interpreter/src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl EvalValue {
i256
}

pub fn deserialize(ctx: &ModuleCtx, ty: Type, b: Vec<u8>) -> Option<Self> {
pub fn deserialize(ctx: &ModuleCtx, ty: Type, b: &[u8]) -> Option<Self> {
Some(Self::Literal(match ty {
Type::I1 => (b[0] & 0b1).into(),
Type::I8 => i8::from_be_bytes(b.try_into().unwrap()).into(),
Expand Down

0 comments on commit 1b8de20

Please sign in to comment.