Set the value of a specific bit, assuming the value is valid
(bitmap []byte, offset uint, value bool)
| 317 | |
| 318 | // Set the value of a specific bit, assuming the value is valid |
| 319 | func (b *BitMapStructure) setBit(bitmap []byte, offset uint, value bool) { |
| 320 | index := offset / 8 |
| 321 | bit := uint(offset % 8) |
| 322 | |
| 323 | if value { |
| 324 | // Set the bit at the offset to 1 |
| 325 | bitmap[index] |= 1 << bit |
| 326 | } else { |
| 327 | // Set the bit at the offset to 0 |
| 328 | bitmap[index] &= ^(1 << bit) |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | // Get the value of a specific bit, assuming the value is valid |
| 333 | func (b *BitMapStructure) getBit(bitmap []byte, offset uint) bool { |