func readVarUInt16(r io.Reader) (uint16, error) {
	// Since we are being given seven bits per byte, we can fit 2 1/4 bytes
	// of input into our two bytes of value, so don't read more than 3 bytes.
	bits, err := readVarNumber(3, r)
	if err != nil {
		return 0, err
	}

	// 0xFC == 0b1111_1100.
	if (len(bits) == 3) && (bits[2]&0xFC != 0) {
		return 0, errors.Errorf("number is too big to fit into uint16: % #x", bits)
	}

	var ret uint16
	// Compact all of the bits into a uint16, ignoring the stop bit.
	// Turn [0111 0001] [1110 0001] into [0011 1000] [1110 0001].
	for _, b := range bits {
		ret <<= 7
		ret |= uint16(b & 0x7F)
	}

	return ret, nil
}
// readVarUInt16 reads until the high bit is set, which signals the end of the
// variable-length number, or we hit the maximum number of bytes for uint16.
// We compress the number it into a uint16.  When used to express a length in
// bytes, the max value would signal a size of  63KB.
readVarUInt16 reads until the high bit is set, which signals the end of the
variable-length number, or we hit the maximum number of bytes for uint16.
We compress the number it into a uint16.  When used to express a length in
bytes, the max value would signal a size of  63KB.
// readVarUInt16 reads until the high bit is set which signals the end of the // variable - length number or we hit the maximum number of bytes for uint16 . // We compress the number it into a uint16 . When used to express a length in // bytes the max value would signal a size of 63KB .
func readVarUInt16(r io.Reader) (uint16, error) {
	bits, err := readVarNumber(3, r)
	if err != nil {
		return 0, err
	}
	if (len(bits) == 3) && (bits[2]&0xFC != 0) {
		return 0, errors.Errorf("number is too big to fit into uint16: % #x", bits)
	}
	var ret uint16
	for _, b := range bits {
		ret <<= 7
		ret |= uint16(b & 0x7F)
	}
	return ret, nil
}
func readVarUInt16 ( r io . Reader ) ( uint16 , error ) { bits , err := readVarNumber ( 3 , r ) if err != nil { return 0 , err } if ( len ( bits ) == 3 ) && ( bits [ 2 ] & 0xFC != 0 ) { return 0 , errors . Errorf ( " " , bits ) } var ret uint16 for _ , b := range bits { ret <<= 7 ret |= uint16 ( b & 0x7F ) } return ret , nil }
readVarUInt16 reads until the high bit is set, which signals the end of the
variable-length number, or we hit the maximum number of bytes for uint16.
readVarUInt16 reads until the high bit is set which signals the end of the variable - length number or we hit the maximum number of bytes for uint16 .
// Since we are being given seven bits per byte, we can fit 2 1/4 bytes // of input into our two bytes of value, so don't read more than 3 bytes. // 0xFC == 0b1111_1100. // Compact all of the bits into a uint16, ignoring the stop bit. // Turn [0111 0001] [1110 0001] into [0011 1000] [1110 0001].