func parseBinaryInt(ann []Symbol, isNegative bool, lengthByte byte, r io.Reader) (Value, error) {
	if lengthByte == 0 {
		if isNegative {
			return nil, errors.New("negative zero is invalid")
		}
		return Int{annotations: ann, isSet: true, binary: []byte{}, value: &big.Int{}}, nil
	}

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

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

	// Negative zero is not valid.
	if isNegative {
		isZero := true
		for _, b := range buf {
			if b != 0 {
				isZero = false
				break
			}
		}
		if isZero {
			return nil, errors.Errorf("negative zero is invalid")
		}
	}

	return Int{annotations: ann, isSet: true, isNegative: isNegative, binary: buf}, nil
}
// parseBinaryInt parses the magnitude and optional length portion of an an Int.
// The magnitude is a UInt so we need to be told what the sign is.
parseBinaryInt parses the magnitude and optional length portion of an an Int.
The magnitude is a UInt so we need to be told what the sign is.
// parseBinaryInt parses the magnitude and optional length portion of an an Int . // The magnitude is a UInt so we need to be told what the sign is .
func parseBinaryInt(ann []Symbol, isNegative bool, lengthByte byte, r io.Reader) (Value, error) {
	if lengthByte == 0 {
		if isNegative {
			return nil, errors.New("negative zero is invalid")
		}
		return Int{annotations: ann, isSet: true, binary: []byte{}, value: &big.Int{}}, nil
	}
	numBytes, errLength := determineLength32(lengthByte, r)
	if errLength != nil {
		return nil, errors.WithMessage(errLength, "unable to parse length of int")
	}
	buf := make([]byte, numBytes)
	if n, err := r.Read(buf); err != nil || n != int(numBytes) {
		return nil, errors.Errorf("unable to read int - read %d bytes of %d with err: %v", n, numBytes, err)
	}
	if isNegative {
		isZero := true
		for _, b := range buf {
			if b != 0 {
				isZero = false
				break
			}
		}
		if isZero {
			return nil, errors.Errorf("negative zero is invalid")
		}
	}
	return Int{annotations: ann, isSet: true, isNegative: isNegative, binary: buf}, nil
}
func parseBinaryInt ( ann [ ] Symbol , isNegative bool , lengthByte byte , r io . Reader ) ( Value , error ) { if lengthByte == 0 { if isNegative { return nil , errors . New ( " " ) } return Int { annotations : ann , isSet : true , binary : [ ] byte { } , value : & big . Int { } } , nil } numBytes , errLength := determineLength32 ( lengthByte , r ) if errLength != nil { return nil , errors . WithMessage ( errLength , " " ) } buf := make ( [ ] byte , numBytes ) if n , err := r . Read ( buf ) ; err != nil || n != int ( numBytes ) { return nil , errors . Errorf ( " " , n , numBytes , err ) } if isNegative { isZero := true for _ , b := range buf { if b != 0 { isZero = false break } } if isZero { return nil , errors . Errorf ( " " ) } } return Int { annotations : ann , isSet : true , isNegative : isNegative , binary : buf } , nil }
parseBinaryInt parses the magnitude and optional length portion of an an Int.
parseBinaryInt parses the magnitude and optional length portion of an an Int .
// Negative zero is not valid.