hopp/tape/measure.go
2025-06-21 19:27:31 -04:00

13 lines
222 B
Go

package tape
// IntBytes returns the number of bytes required to hold a given unsigned
// integer.
func IntBytes(value uint64) int {
bytes := 0
for value > 0 || bytes == 0 {
value >>= 8;
bytes ++
}
return bytes
}