Skip to content

Commit

Permalink
fix: address and size alignment check
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenctw committed Mar 12, 2024
1 parent 897a0bc commit 8b879e1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ready_src/Memory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ library Memory {
// assert position and size are aligned
// position has to be a multiple of size
// equivalent to: size = 2^a, position = 2^b, position = size * 2^c, where c >= 0
assert(((s - 1) & position) == 0);
assert(((s - 1) & addr) == 0);
uint64 stride = position / s;
return Stride.wrap(stride);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Memory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ library Memory {
// assert position and size are aligned
// position has to be a multiple of size
// equivalent to: size = 2^a, position = 2^b, position = size * 2^c, where c >= 0
assert(((s - 1) & position) == 0);
assert(((s - 1) & addr) == 0);
uint64 stride = position / s;
return Stride.wrap(stride);
}
Expand Down

0 comments on commit 8b879e1

Please sign in to comment.