// TryReadBits attempts to read nb bits using the contents of the bit buffer
// alone. It returns the value and whether it succeeded.
//
// This method is designed to be inlined for performance reasons.
TryReadBits attempts to read nb bits using the contents of the bit buffer
alone. It returns the value and whether it succeeded.

This method is designed to be inlined for performance reasons.
// TryReadBits attempts to read nb bits using the contents of the bit buffer // alone . It returns the value and whether it succeeded . // // This method is designed to be inlined for performance reasons .
func (pr *Reader) TryReadBits(nb uint) (uint, bool) {
	if pr.numBits < nb {
		return 0, false
	}
	val := uint(pr.bufBits & uint64(1<<nb-1))
	pr.bufBits >>= nb
	pr.numBits -= nb
	return val, true
}
func ( pr * Reader ) TryReadBits ( nb uint ) ( uint , bool ) { if pr . numBits < nb { return 0 , false } val := uint ( pr . bufBits & uint64 ( 1 << nb - 1 ) ) pr . bufBits >>= nb pr . numBits -= nb return val , true }
TryReadBits attempts to read nb bits using the contents of the bit buffer
alone.
TryReadBits attempts to read nb bits using the contents of the bit buffer alone .