Skip to content

Commit

Permalink
Merge pull request #2006 from CosmWasm/avoid-unnecessary-error-handling
Browse files Browse the repository at this point in the history
Avoid unnecessary error handling in from_wasm_bytes
  • Loading branch information
chipshort authored Jan 25, 2024
2 parents f69ffc7 + e68dd99 commit 46201a6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/vm/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ type RegionBytes = [u8; size_of::<Region>()];

impl Region {
fn from_wasm_bytes(bytes: RegionBytes) -> Self {
let offset = u32::from_le_bytes(bytes[0..4].try_into().unwrap());
let capacity = u32::from_le_bytes(bytes[4..8].try_into().unwrap());
let length = u32::from_le_bytes(bytes[8..12].try_into().unwrap());
let offset = u32::from_le_bytes([bytes[0], bytes[1], bytes[2], bytes[3]]);
let capacity = u32::from_le_bytes([bytes[4], bytes[5], bytes[6], bytes[7]]);
let length = u32::from_le_bytes([bytes[8], bytes[9], bytes[10], bytes[11]]);
Region {
offset,
capacity,
Expand Down

0 comments on commit 46201a6

Please sign in to comment.