180 - OZ Bitmaps
OpenZeppelin BitMaps: Library for managing uint256
to bool
mapping in a compact and efficient way, providing the keys are sequential.
-
struct BitMap:
mapping(uint256 => uint256)
_data; -
get(BitMap storage bitmap, uint256 index)
→bool:
Returns whether the bit atindex
is set. -
setTo(BitMap storage bitmap, uint256 index, bool value)
: Sets the bit atindex
to the booleanvalue
-
function set(BitMap storage bitmap, uint256 index)
: Sets the bit atindex
-
function unset(BitMap storage bitmap, uint256 index)
: Unsets the bit atindex
- Managing Bitmaps
uint256
->bool
get(bitmap, index)
->bool
setTo(bitmap, index, value)
set(bitmap, index)
unset(bitmap, index)