Skip to content

Commit

Permalink
fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
weilzkm committed Feb 5, 2025
1 parent ed028b9 commit 9950352
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion emulator/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ impl InstrumentedState {
log::debug!("input: {:?}", vec);
assert_eq!(a0 % 4, 0, "hint read address not aligned to 4 bytes");
if a1 >= 1 {
self.state.cycle += (a1 as u64 + 31) / 32;
self.state.cycle += (a1 as u64).div_ceil(32);
}
for i in (0..a1).step_by(4) {
// Get each byte in the chunk
Expand Down
2 changes: 1 addition & 1 deletion runtime/precompiles/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl std::io::Write for SyscallWriter {
pub fn read_vec() -> Vec<u8> {
let len = unsafe { syscall_hint_len() };
// Round up to the nearest multiple of 4 so that the memory allocated is in whole words
let capacity = (len + 3) / 4 * 4;
let capacity = len.div_ceil(4);

// Allocate a buffer of the required length that is 4 byte aligned
let layout = Layout::from_size_align(capacity, 4).expect("vec is too large");
Expand Down

0 comments on commit 9950352

Please sign in to comment.