From 8b879e18bbeb4e47d5db1691fda17fda2402d143 Mon Sep 17 00:00:00 2001 From: Stephen Chen <20940639+stephenctw@users.noreply.github.com> Date: Tue, 12 Mar 2024 20:24:36 +0800 Subject: [PATCH] fix: address and size alignment check --- ready_src/Memory.sol | 2 +- src/Memory.sol | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ready_src/Memory.sol b/ready_src/Memory.sol index 7fa8540e..c469829d 100644 --- a/ready_src/Memory.sol +++ b/ready_src/Memory.sol @@ -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); } diff --git a/src/Memory.sol b/src/Memory.sol index 7fa8540e..c469829d 100644 --- a/src/Memory.sol +++ b/src/Memory.sol @@ -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); }