// addBits16ZeroNC will add up to 16 bits.
// It will not check if there is space for them,
// so the caller must ensure that it has flushed recently.
// This is fastest if bits can be zero.
495892
func (b *bitWriter) addBits16ZeroNC(value uint16, bits uint8) {
	if bits == 0 {
		return
	}
	value <<= (16 - bits) & 15
	value >>= (16 - bits) & 15
	b.bitContainer |= uint64(value) << (b.nBits & 63)
	b.nBits += bits
}
969295
func UnsignedBitsRequired(bits int64) int {
	if bits == 0 {
		return 1
	}
	n := uint64(bits)
	ans := 0
	for n != 0 {
		n >>= 1
		ans++
	}
	return ans
}
1053192
func (alac *Alac) readbits(bits int) uint32 {
	var result int32 = 0

	if bits > 16 {
		bits -= 16
		result = int32(alac.readbits_16(16) << uint(bits))
	}

	result |= int32(alac.readbits_16(bits))

	return uint32(result)
}
1110057
func (mcp *MCP23S17) WriteBit(data byte, bit_num uint, address byte) {
	value := mcp.Read(address)
	if data > 0 {
		value = value | (1 << bit_num) //set
	} else {
		value = value & (0xff ^ (1 << bit_num)) //clear
	}
	mcp.Write(value, address)
}
1355914
func (b *Builder) addDouble(v float64) {
	bits := math.Float64bits(v)
	b.buf.ReserveSpace(9)
	b.buf.WriteByte(0x1b)
	binary.LittleEndian.PutUint64(b.buf.Grow(8), bits)
}
1220731
func (e Encoder) AppendUints16(dst []byte, vals []uint16) []byte {
	major := majorTypeArray
	l := len(vals)
	if l == 0 {
		return e.AppendArrayEnd(e.AppendArrayStart(dst))
	}
	if l <= additionalMax {
		lb := byte(l)
		dst = append(dst, byte(major|lb))
	} else {
		dst = appendCborTypePrefix(dst, major, uint64(l))
	}
	for _, v := range vals {
		dst = e.AppendUint16(dst, v)
	}
	return dst
}
743007
func (bl *BitList) AddBits(b int, count byte) {
	for i := int(count) - 1; i >= 0; i-- {
		bl.AddBit(((b >> uint(i)) & 1) == 1)
	}
}
1143629
func CountBitsUint64s(b []uint64) int {
	c := 0
	for _, x := range b {
		c += CountBitsUint64(x)
	}
	return c
}
575732
func (e Encoder) AppendInts16(dst []byte, vals []int16) []byte {
	major := majorTypeArray
	l := len(vals)
	if l == 0 {
		return e.AppendArrayEnd(e.AppendArrayStart(dst))
	}
	if l <= additionalMax {
		lb := byte(l)
		dst = append(dst, byte(major|lb))
	} else {
		dst = appendCborTypePrefix(dst, major, uint64(l))
	}
	for _, v := range vals {
		dst = e.AppendInt(dst, int(v))
	}
	return dst
}
212478
func Len16(x uint16) (n int) {
	if x >= 1<<8 {
		x >>= 8
		n = 8
	}
	return n + int(len8tab[x])
}
463713
func (a *Array) Uint16(i uint16) *Array {
	a.buf = enc.AppendUint16(enc.AppendArrayDelim(a.buf), i)
	return a
}
396222
func countBits(n *big.Int) int {
	var count int = 0
	for _, b := range n.Bytes() {
		count += int(bitCounts[b])
	}
	return count
}
796718
func CountBitsInt16s(b []int16) int {
	c := 0
	for _, x := range b {
		c += CountBitsInt16(x)
	}
	return c
}
195432
func CountBitsUint8s(b []uint8) int {
	c := 0
	for _, x := range b {
		c += CountBitsUint8(x)
	}
	return c
}
1272899
func (BitCurve *BitCurve) Add(x1, y1, x2, y2 *big.Int) (*big.Int, *big.Int) {
	z := new(big.Int).SetInt64(1)
	return BitCurve.affineFromJacobian(BitCurve.addJacobian(x1, y1, z, x2, y2, z))
}
254042
func (rb *Bitmap) Add(x uint32) {
	hb := highbits(x)
	ra := &rb.highlowcontainer
	i := ra.getIndex(hb)
	if i >= 0 {
		var c container
		c = ra.getWritableContainerAtIndex(i).iaddReturnMinimized(lowbits(x))
		rb.highlowcontainer.setContainerAtIndex(i, c)
	} else {
		newac := newArrayContainer()
		rb.highlowcontainer.insertNewKeyValueAt(-i-1, hb, newac.iaddReturnMinimized(lowbits(x)))
	}
}
522571
func (c Context) Ints16(key string, i []int16) Context {
	c.l.context = enc.AppendInts16(enc.AppendKey(c.l.context, key), i)
	return c
}