Skip to main content

BitMap

internal function hasBit

function hasBit(uint256 bitmap, uint8 index) internal pure returns (bool)
InputTypeDescription
bitmapuint256The uint256 representation of bits.
indexuint8The index number to check whether 1 or 0 is set.
Output
0boolReturns true if the bit is set at index on bitmap.

internal function flipBit

function flipBit(uint256 bitmap, uint8 index) internal pure returns (uint256)
InputTypeDescription
bitmapuint256The uint256 representation of bits.
indexuint8The index number to set the bit.
Output
0uint256Returns a new number in which the bit is set at index.
© 2024