From 4de467ce6b101761ff4f8233c135ee38f0d50870 Mon Sep 17 00:00:00 2001 From: David Philipson Date: Sat, 13 Jan 2024 23:19:08 -0500 Subject: [PATCH] fix: [spearbit-11] Clear bits more efficiently (#55) --- src/account/AccountExecutor.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/account/AccountExecutor.sol b/src/account/AccountExecutor.sol index 7b5c01d54..e76c5a282 100644 --- a/src/account/AccountExecutor.sol +++ b/src/account/AccountExecutor.sol @@ -123,9 +123,9 @@ abstract contract AccountExecutor { // mask out the fist 4 bytes, then OR in the new selector. let existingWord := mload(add(buffer, 0x20)) // Clear the upper 4 bytes of the existing word - existingWord := and(existingWord, shr(32, not(0))) + existingWord := shr(32, shl(32, existingWord)) // Clear the lower 28 bytes of the selector - pluginSelector := and(pluginSelector, shl(224, 0xFFFFFFFF)) + pluginSelector := shl(224, shr(224, pluginSelector)) // OR in the new selector existingWord := or(existingWord, pluginSelector) mstore(add(buffer, 0x20), existingWord)