diff --git a/src/utils/LibBytes.sol b/src/utils/LibBytes.sol index 2e2ad8ae9..891828084 100644 --- a/src/utils/LibBytes.sol +++ b/src/utils/LibBytes.sol @@ -103,7 +103,7 @@ library LibBytes { let packed := sload($.slot) let n := shr(8, packed) for { let i := 0 } 1 {} { - if iszero(eq(and(packed, 0xff), 0xff)) { + if iszero(eq(or(packed, 0xff), packed)) { mstore(o, packed) n := and(0xff, packed) i := 0x1f diff --git a/src/utils/g/LibBytes.sol b/src/utils/g/LibBytes.sol index 3fa722203..4c9515966 100644 --- a/src/utils/g/LibBytes.sol +++ b/src/utils/g/LibBytes.sol @@ -107,7 +107,7 @@ library LibBytes { let packed := sload($.slot) let n := shr(8, packed) for { let i := 0 } 1 {} { - if iszero(eq(and(packed, 0xff), 0xff)) { + if iszero(eq(or(packed, 0xff), packed)) { mstore(o, packed) n := and(0xff, packed) i := 0x1f