From 78a94768aaa92c918ecb06b31c6a67576c7be21d Mon Sep 17 00:00:00 2001 From: Vectorized Date: Tue, 17 Dec 2024 10:28:01 +0000 Subject: [PATCH] Optimize LibBytes storage check --- src/utils/LibBytes.sol | 2 +- src/utils/g/LibBytes.sol | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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