diff --git a/crates/context/src/journaled_state.rs b/crates/context/src/journaled_state.rs index 14fc910401..79caea501f 100644 --- a/crates/context/src/journaled_state.rs +++ b/crates/context/src/journaled_state.rs @@ -418,7 +418,7 @@ impl Journal { /// /// There are few steps done: /// 1. Make created account warm loaded (AccessList) and this should - /// be done before subroutine checkpoint is created. + /// be done before subroutine checkpoint is created. /// 2. Check if there is collision of newly created account with existing one. /// 3. Mark created account as created. /// 4. Add fund to created account diff --git a/crates/interpreter/src/instructions/utility.rs b/crates/interpreter/src/instructions/utility.rs index 9fda582c3d..d64e2967a6 100644 --- a/crates/interpreter/src/instructions/utility.rs +++ b/crates/interpreter/src/instructions/utility.rs @@ -13,7 +13,7 @@ pub fn cast_slice_to_u256(slice: &[u8], dest: &mut U256) { } assert!(slice.len() <= 32, "slice too long"); - let n_words = (slice.len() + 31) / 32; + let n_words = slice.len().div_ceil(32); // SAFETY: Length checked above. unsafe { @@ -55,7 +55,7 @@ pub fn cast_slice_to_u256(slice: &[u8], dest: &mut U256) { i += 1; } - debug_assert_eq!((i + 3) / 4, n_words, "wrote too much"); + debug_assert_eq!(i.div_ceil(4), n_words, "wrote too much"); // Zero out upper bytes of last word let m = i % 4; // 32 / 8 diff --git a/crates/interpreter/src/interpreter/stack.rs b/crates/interpreter/src/interpreter/stack.rs index ad3da7ee75..1612b78222 100644 --- a/crates/interpreter/src/interpreter/stack.rs +++ b/crates/interpreter/src/interpreter/stack.rs @@ -285,7 +285,7 @@ impl Stack { return Ok(()); } - let n_words = (slice.len() + 31) / 32; + let n_words = slice.len().div_ceil(32); let new_len = self.data.len() + n_words; if new_len > STACK_LIMIT { return Err(InstructionResult::StackOverflow); @@ -330,7 +330,7 @@ impl Stack { i += 1; } - debug_assert_eq!((i + 3) / 4, n_words, "wrote too much"); + debug_assert_eq!(i.div_ceil(4), n_words, "wrote too much"); // Zero out upper bytes of last word let m = i % 4; // 32 / 8