// Copyright 2025 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package trace

import (
	
)

// maxVarintLenN is the maximum length of a varint-encoded N-bit integer.
const maxVarintLen64 = 10

var (
	errOverflow = errors.New("binary: varint overflows a 64-bit integer")
	errEOB      = errors.New("binary: end of buffer")
)

// TODO deduplicate this function.
func readUvarint( []byte) (uint64, int, error) {
	var  uint64
	var  uint
	var  byte
	for  := 0;  < maxVarintLen64 &&  < len(); ++ {
		 = []
		if  < 0x80 {
			if  == maxVarintLen64-1 &&  > 1 {
				return , , errOverflow
			}
			return  | uint64()<<,  + 1, nil
		}
		 |= uint64(&0x7f) << 
		 += 7
	}
	return , len(), errOverflow
}

// putUvarint encodes a uint64 into buf and returns the number of bytes written.
// If the buffer is too small, PutUvarint will panic.
// TODO deduplicate this function.
func putUvarint( []byte,  uint64) int {
	 := 0
	for  >= 0x80 {
		[] = byte() | 0x80
		 >>= 7
		++
	}
	[] = byte()
	return  + 1
}