Get the value of a specific bit, assuming the value is valid
(bitmap []byte, offset uint)
| 331 | |
| 332 | // Get the value of a specific bit, assuming the value is valid |
| 333 | func (b *BitMapStructure) getBit(bitmap []byte, offset uint) bool { |
| 334 | index := offset / 8 |
| 335 | bit := uint(offset % 8) |
| 336 | |
| 337 | value := bitmap[index] & (1 << bit) |
| 338 | |
| 339 | return value > 0 |
| 340 | } |
| 341 | |
| 342 | // getBitmapFromDB retrieves data from the database. When isKeyCanNotExist is true, it returns an empty slice if the key doesn't exist instead of an error. |
| 343 | func (b *BitMapStructure) getBitmapFromDB(key string, isKeyCanNotExist bool) ([]byte, uint, error) { |