Sha256: 9916a44664333cd2ec2f702a240162f1fcba36fcb5f649578d036b8717c87532
Contents?: true
Size: 732 Bytes
Versions: 11
Compression:
Stored size: 732 Bytes
Contents
module Skylight module Util class OutOfRangeError < RuntimeError; end module Bytes # Helper consts MinUint64 = 0 MaxUint64 = (1<<64)-1 MinInt64 = -(1<<63) MaxInt64 = (1<<63)-1 # varints def append_uint64(buf, n) if n < MinUint64 || n > MaxUint64 raise OutOfRangeError, n end while true bits = n & 0x7F n >>= 7 if n == 0 return buf << bits end buf << (bits | 0x80) end end def str_bytesize(str) str.bytesize end def append_string(buf, str) append_uint64(buf, str_bytesize(str)) buf << str end end end end
Version data entries
11 entries across 11 versions & 1 rubygems