13 lines
222 B
Go
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
|
|
}
|