func marshalInt64NearestDelta(dst []byte, src []int64, precisionBits uint8) (result []byte, firstValue int64) {
	if len(src) < 1 {
		logger.Panicf("BUG: src must contain at least 1 item; got %d items", len(src))
	}
	if err := CheckPrecisionBits(precisionBits); err != nil {
		logger.Panicf("BUG: %s", err)
	}

	firstValue = src[0]
	v := src[0]
	src = src[1:]
	is := GetInt64s(len(src))
	if precisionBits == 64 {
		// Fast path.
		for i, next := range src {
			d := next - v
			v += d
			is.A[i] = d
		}
	} else {
		// Slower path.
		trailingZeros := getTrailingZeros(v, precisionBits)
		for i, next := range src {
			d, tzs := nearestDelta(next, v, precisionBits, trailingZeros)
			trailingZeros = tzs
			v += d
			is.A[i] = d
		}
	}
	dst = MarshalVarInt64s(dst, is.A)
	PutInt64s(is)
	return dst, firstValue
}
// marshalInt64NearestDelta encodes src using `nearest delta` encoding
// with the given precisionBits and appends the encoded value to dst.
//
// precisionBits must be in the range [1...64], where 1 means 50% precision,
// while 64 means 100% precision, i.e. lossless encoding.
marshalInt64NearestDelta encodes src using `nearest delta` encoding
with the given precisionBits and appends the encoded value to dst.

precisionBits must be in the range [1...64], where 1 means 50% precision,
while 64 means 100% precision, i.e. lossless encoding.
// marshalInt64NearestDelta encodes src using ` nearest delta ` encoding // with the given precisionBits and appends the encoded value to dst . // // precisionBits must be in the range [ 1 ... 64 ] where 1 means 50% precision // while 64 means 100% precision i . e . lossless encoding .
func marshalInt64NearestDelta(dst []byte, src []int64, precisionBits uint8) (result []byte, firstValue int64) {
	if len(src) < 1 {
		logger.Panicf("BUG: src must contain at least 1 item; got %d items", len(src))
	}
	if err := CheckPrecisionBits(precisionBits); err != nil {
		logger.Panicf("BUG: %s", err)
	}
	firstValue = src[0]
	v := src[0]
	src = src[1:]
	is := GetInt64s(len(src))
	if precisionBits == 64 {
		for i, next := range src {
			d := next - v
			v += d
			is.A[i] = d
		}
	} else {
		trailingZeros := getTrailingZeros(v, precisionBits)
		for i, next := range src {
			d, tzs := nearestDelta(next, v, precisionBits, trailingZeros)
			trailingZeros = tzs
			v += d
			is.A[i] = d
		}
	}
	dst = MarshalVarInt64s(dst, is.A)
	PutInt64s(is)
	return dst, firstValue
}
func marshalInt64NearestDelta ( dst [ ] byte , src [ ] int64 , precisionBits uint8 ) ( result [ ] byte , firstValue int64 ) { if len ( src ) < 1 { logger . Panicf ( " " , len ( src ) ) } if err := CheckPrecisionBits ( precisionBits ) ; err != nil { logger . Panicf ( " " , err ) } firstValue = src [ 0 ] v := src [ 0 ] src = src [ 1 : ] is := GetInt64s ( len ( src ) ) if precisionBits == 64 { for i , next := range src { d := next - v v += d is . A [ i ] = d } } else { trailingZeros := getTrailingZeros ( v , precisionBits ) for i , next := range src { d , tzs := nearestDelta ( next , v , precisionBits , trailingZeros ) trailingZeros = tzs v += d is . A [ i ] = d } } dst = MarshalVarInt64s ( dst , is . A ) PutInt64s ( is ) return dst , firstValue }
marshalInt64NearestDelta encodes src using `nearest delta` encoding
with the given precisionBits and appends the encoded value to dst.
marshalInt64NearestDelta encodes src using ` nearest delta ` encoding with the given precisionBits and appends the encoded value to dst .
// Fast path. // Slower path.