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

	// 0xF0 == 0b1111_0000.
	if (len(bits) == 5) && (bits[4]&0xF0 != 0) {
		return 0, errors.Errorf("number is too big to fit into uint32: % #x", bits)
	}

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

	return ret, nil
}
// readVarUInt32 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 uint32.
// We compress the number into a uint32.  When used to express a length in
// bytes, the max value would signal a size of 3GB.
readVarUInt32 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 uint32.
We compress the number into a uint32.  When used to express a length in
bytes, the max value would signal a size of 3GB.
// readVarUInt32 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 uint32 . // We compress the number into a uint32 . When used to express a length in // bytes the max value would signal a size of 3GB .
func readVarUInt32(r io.Reader) (uint32, error) {
	bits, err := readVarNumber(5, r)
	if err != nil {
		return 0, err
	}
	if (len(bits) == 5) && (bits[4]&0xF0 != 0) {
		return 0, errors.Errorf("number is too big to fit into uint32: % #x", bits)
	}
	var ret uint32
	for _, b := range bits {
		ret <<= 7
		ret |= uint32(b & 0x7F)
	}
	return ret, nil
}
func readVarUInt32 ( r io . Reader ) ( uint32 , error ) { bits , err := readVarNumber ( 5 , r ) if err != nil { return 0 , err } if ( len ( bits ) == 5 ) && ( bits [ 4 ] & 0xF0 != 0 ) { return 0 , errors . Errorf ( " " , bits ) } var ret uint32 for _ , b := range bits { ret <<= 7 ret |= uint32 ( b & 0x7F ) } return ret , nil }
readVarUInt32 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 uint32.
readVarUInt32 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 uint32 .
// Since we are being given seven bits per byte, we can fit 4 1/2 bytes // of input into our four bytes of value, so don't read more than 5 bytes. // 0xF0 == 0b1111_0000. // Compact all of the bits into a uint32, ignoring the stop bit. // Turn [0111 1111] [1110 1111] into [0011 1111] [1110 1111].