Closed anhcao142 closed 5 years ago
@sbinet are you familiar with the leb128 encoding?
@anhcao142 where is the ReadUint64
defined? there are ReadVarint64
and ReadVarUint32
in package leb128
, and they are works.
Sorry, my bad, I actually mean ReadVarUint64
and let me check again
@laizy It's actually a mistake from my side, I'm sorry for troubling you. But before closing, can I ask why you don't have ReadVarUint64
method?
@anhcao142 ,maybe it is not used currently? but readVarUint(r io.Reader, n uint)
is a general-purpose function for read uintN
(like uint7, uint16), so you can define ReadVarUint64
as :
func ReadVarUint64(r io.Reader) (uint64, error) {
n, err := readVarUint(r, 64)
if err != nil {
return 0, err
}
return uint64(n), nil
}