Skip to content

Commit

Permalink
Fix formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
azteca1998 committed Oct 10, 2024
1 parent 3c15f13 commit 45be8c1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/executor/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ impl AotContractExecutor {
};

let tag = *unsafe { enum_ptr.cast::<u8>().as_ref() } as usize;
let tag &= 0x01; // Filter out bits that are not part of the enum's tag.
let tag = tag & 0x01; // Filter out bits that are not part of the enum's tag.

// layout of both enum variants, both are a array of felts
let value_layout = unsafe { Layout::from_size_align_unchecked(24, 8) };
Expand Down
4 changes: 2 additions & 2 deletions src/values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,15 +575,15 @@ impl Value {
value
}
CoreTypeConcrete::EcPoint(_) => {
let data = ptr.cast::<[[u8; 32]; 2]>().as_ref();
let data = ptr.cast::<[[u8; 32]; 2]>().as_mut();

data[0][31] &= 0x0F; // Filter out first 4 bits (they're outside an i252).
data[1][31] &= 0x0F; // Filter out first 4 bits (they're outside an i252).

Self::EcPoint(Felt::from_bytes_le(&data[0]), Felt::from_bytes_le(&data[1]))
}
CoreTypeConcrete::EcState(_) => {
let data = ptr.cast::<[[u8; 32]; 4]>().as_ref();
let data = ptr.cast::<[[u8; 32]; 4]>().as_mut();

data[0][31] &= 0x0F; // Filter out first 4 bits (they're outside an i252).
data[1][31] &= 0x0F; // Filter out first 4 bits (they're outside an i252).
Expand Down

0 comments on commit 45be8c1

Please sign in to comment.