MCPcopy Create free account
hub / github.com/Comcast/gaad / ReadBit

Method ReadBit

bitreader/bitreader.go:170–177  ·  view source on GitHub ↗

Return the next bit from the buffer

()

Source from the content-addressed store, hash-verified

168
169// Return the next bit from the buffer
170func (p *BitReader) ReadBit() (byte, error) {
171 if p.BitsLeft() == 0 {
172 return 0, fmt.Errorf("Not enough bits left to read")
173 }
174 r := (p.currentByte & netmasks[p.posInCurrentByte]) >> p.posInCurrentByte
175 p.SkipBits(1)
176 return r, nil
177}
178
179// Return n number of bytes read from the buffer
180func (p *BitReader) ReadBytes(n uint) ([]byte, error) {

Callers 14

ReadBitAsBoolMethod · 0.95
ReadBitsAsUIntMethod · 0.95
ReadBitsAsUInt8Method · 0.95
ReadBitsAsUInt32Method · 0.95
ReadBitsAsUInt16Method · 0.95
ReadBitsAsIntMethod · 0.95
ReadBitsToByteArrayMethod · 0.95
ReadBitsMethod · 0.95
ReadUEMethod · 0.95
TestReadBit1Function · 0.95
adts_fixed_headerMethod · 0.80
dynamic_range_infoMethod · 0.80

Calls 2

BitsLeftMethod · 0.95
SkipBitsMethod · 0.95

Tested by 1

TestReadBit1Function · 0.76