MCPcopy Create free account
hub / github.com/ByteStorage/FlyDB / getBit

Method getBit

structure/bitmap_1.go:333–340  ·  view source on GitHub ↗

Get the value of a specific bit, assuming the value is valid

(bitmap []byte, offset uint)

Source from the content-addressed store, hash-verified

331
332// Get the value of a specific bit, assuming the value is valid
333func (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.
343func (b *BitMapStructure) getBitmapFromDB(key string, isKeyCanNotExist bool) ([]byte, uint, error) {

Callers 6

GetBitMethod · 0.95
GetBitsMethod · 0.95
BitCountMethod · 0.95
BitOpMethod · 0.95
BitDelMethod · 0.95
BitDelsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected