func parseBinarySymbol(ann []Symbol, lengthByte byte, r io.Reader) (Value, error) {
	if lengthByte == 0 {
		return Symbol{annotations: ann}, nil
	}

	numBytes, errLength := determineLength16(lengthByte, r)
	if errLength != nil {
		return nil, errors.WithMessage(errLength, "unable to parse length of symbol")
	}

	// Sanity check the number of bytes expected for the Symbol ID.
	// If it takes more than 4 bytes of UInt, then it won't fit into int32.
	if numBytes > 4 {
		return nil, errors.Errorf("symbol ID length of %d bytes exceeds expected maximum of 4", numBytes)
	}

	buf := make([]byte, numBytes)
	if n, err := r.Read(buf); err != nil || n != int(numBytes) {
		return nil, errors.Errorf("unable to read symbol ID - read %d bytes of %d with err: %v", n, numBytes, err)
	}

	var symbolID uint32
	for _, b := range buf {
		symbolID <<= 8
		symbolID |= uint32(b)
	}

	// math.MaxInt32 = 0x7F_FF_FF_FF
	if (symbolID & 0x80000000) != 0 {
		return nil, errors.Errorf("uint32 value %d overflows int32", symbolID)
	}

	return Symbol{annotations: ann, id: int32(symbolID)}, nil
}
// parseBinarySymbol parses an integer Symbol ID.
parseBinarySymbol parses an integer Symbol ID.
// parseBinarySymbol parses an integer Symbol ID .
func parseBinarySymbol(ann []Symbol, lengthByte byte, r io.Reader) (Value, error) {
	if lengthByte == 0 {
		return Symbol{annotations: ann}, nil
	}
	numBytes, errLength := determineLength16(lengthByte, r)
	if errLength != nil {
		return nil, errors.WithMessage(errLength, "unable to parse length of symbol")
	}
	if numBytes > 4 {
		return nil, errors.Errorf("symbol ID length of %d bytes exceeds expected maximum of 4", numBytes)
	}
	buf := make([]byte, numBytes)
	if n, err := r.Read(buf); err != nil || n != int(numBytes) {
		return nil, errors.Errorf("unable to read symbol ID - read %d bytes of %d with err: %v", n, numBytes, err)
	}
	var symbolID uint32
	for _, b := range buf {
		symbolID <<= 8
		symbolID |= uint32(b)
	}
	if (symbolID & 0x80000000) != 0 {
		return nil, errors.Errorf("uint32 value %d overflows int32", symbolID)
	}
	return Symbol{annotations: ann, id: int32(symbolID)}, nil
}
func parseBinarySymbol ( ann [ ] Symbol , lengthByte byte , r io . Reader ) ( Value , error ) { if lengthByte == 0 { return Symbol { annotations : ann } , nil } numBytes , errLength := determineLength16 ( lengthByte , r ) if errLength != nil { return nil , errors . WithMessage ( errLength , " " ) } if numBytes > 4 { return nil , errors . Errorf ( " " , numBytes ) } buf := make ( [ ] byte , numBytes ) if n , err := r . Read ( buf ) ; err != nil || n != int ( numBytes ) { return nil , errors . Errorf ( " " , n , numBytes , err ) } var symbolID uint32 for _ , b := range buf { symbolID <<= 8 symbolID |= uint32 ( b ) } if ( symbolID & 0x80000000 ) != 0 { return nil , errors . Errorf ( " " , symbolID ) } return Symbol { annotations : ann , id : int32 ( symbolID ) } , nil }
parseBinarySymbol parses an integer Symbol ID.
parseBinarySymbol parses an integer Symbol ID .
// Sanity check the number of bytes expected for the Symbol ID. // If it takes more than 4 bytes of UInt, then it won't fit into int32. // math.MaxInt32 = 0x7F_FF_FF_FF