func CopyVarint64(buffer []byte) []byte {
	result := make([]byte, 0)
loop:
	for count := 0; count < Varint64MaximumBytes; count += 1 {
		currentByte := buffer[count]
		result = append(result, currentByte)
		if 0 == currentByte&0x80 {
			break loop
		}
	}
	return result
}
CopyVarint64 - make a copy of a Varint64 from the beginning of a buffer
package util
const Varint64MaximumBytes = 9
func ToVarint64(value uint64) []byte {
	result := make([]byte, 0, Varint64MaximumBytes)
	if value < 0x80 {
		result = append(result, byte(value))
		return result
	}
	for i := 0; i < Varint64MaximumBytes && value != 0; i += 1 {
		ext := uint64(0x80)
		if value < 0x80 {
			ext = 0x00
		}
		result = append(result, byte(value|ext))
		value >>= 7
	}
	return result
}
func FromVarint64(buffer []byte) (uint64, int) {
	result := uint64(0)
	shift := uint(0)
	count := 0
	for count < len(buffer) {
		currByte := uint64(buffer[count])
		count += 1
		if count < Varint64MaximumBytes {
			result |= currByte & 0x7f << shift
			if 0 == currByte&0x80 {
				return result, count
			}
		} else {
			result |= currByte << shift
			return result, count
		}
		shift += 7
	}
	return 0, 0
}