func (b *bitReader) getBitsFast(n uint8) int {
	const regMask = 64 - 1
	v := uint32((b.value << (b.bitsRead & regMask)) >> ((regMask + 1 - n) & regMask))
	b.bitsRead += n
	return int(v)
}
getBitsFast requires that at least one bit is requested every time.
There are no checks if the buffer is filled.
package zstd
import (
	"errors"
	"io"
	"math/bits"
)
type bitReader struct {
	in       []byte
	off      uint    
	value    uint64  
	bitsRead uint8
}
func (b *bitReader) init(in []byte) error {
	if len(in) < 1 {
		return errors.New("corrupt stream: too short")
	}
	b.in = in
	b.off = uint(len(in))
	v := in[len(in)-1]
	if v == 0 {
		return errors.New("corrupt stream, did not find end of stream")
	}
	b.bitsRead = 64
	b.value = 0
	b.fill()
	b.fill()
	b.bitsRead += 8 - uint8(highBits(uint32(v)))
	return nil
}
func (b *bitReader) getBits(n uint8) int {
	if n == 0   {
		return 0
	}
	return b.getBitsFast(n)
}