From 9f31747554bc47dbc12b98a6f4477e23459463f8 Mon Sep 17 00:00:00 2001 From: Sean Date: Thu, 2 Nov 2023 15:10:36 +0900 Subject: [PATCH] fix: `_split` has to return `uint8` --- contracts/MinBitMap.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/MinBitMap.sol b/contracts/MinBitMap.sol index 1cc93e8..0a18e94 100644 --- a/contracts/MinBitMap.sol +++ b/contracts/MinBitMap.sol @@ -25,7 +25,7 @@ library MinBitMap { return core.bitmap == 0; } - function _split(uint24 value) private pure returns (uint256 wordIndex, uint256 bitIndex) { + function _split(uint24 value) private pure returns (uint256 wordIndex, uint8 bitIndex) { assembly { bitIndex := value wordIndex := shr(8, value) @@ -56,9 +56,9 @@ library MinBitMap { core.bitmapMapping[wordIndex] = word | mask; if (word == 0) { + mask = 1 << (wordIndex & 0xff); wordIndex = wordIndex >> 8; core.bitmap = core.bitmap | (1 << wordIndex); - mask = 1 << (wordIndex & 0xff); wordIndex = ~wordIndex; core.bitmapMapping[wordIndex] = core.bitmapMapping[wordIndex] | mask; }