MCPcopy Create free account
hub / github.com/google/gapid / ReadUint

Function ReadUint

core/data/binary/reader.go:67–81  ·  view source on GitHub ↗

ReadUint reads an unsigned integer of either 8, 16, 32 or 64 bits from r, returning the result as a uint64.

(r Reader, bits int32)

Source from the content-addressed store, hash-verified

65// ReadUint reads an unsigned integer of either 8, 16, 32 or 64 bits from r,
66// returning the result as a uint64.
67func ReadUint(r Reader, bits int32) uint64 {
68 switch bits {
69 case 8:
70 return uint64(r.Uint8())
71 case 16:
72 return uint64(r.Uint16())
73 case 32:
74 return uint64(r.Uint32())
75 case 64:
76 return r.Uint64()
77 default:
78 r.SetError(fmt.Errorf("Unsupported integer bit count %v", bits))
79 return 0
80 }
81}
82
83// ReadInt reads a signed integer of either 8, 16, 32 or 64 bits from r,
84// returning the result as a int64.

Callers

nothing calls this directly

Calls 5

Uint8Method · 0.65
Uint16Method · 0.65
Uint32Method · 0.65
Uint64Method · 0.65
SetErrorMethod · 0.65

Tested by

no test coverage detected