Sha256: db49b8defa50892d655aeb30691f2c70fd900c6724786231d6f7e86231fc1163
Contents?: true
Size: 497 Bytes
Versions: 63
Compression:
Stored size: 497 Bytes
Contents
require 'protobuf/field/varint_field' module Protobuf module Field class IntegerField < VarintField ## # Public Instance Methods # def decode(value) value -= 0x1_0000_0000_0000_0000 if (value & 0x8000_0000_0000_0000).nonzero? value end def encode(value) # original Google's library uses 64bits integer for negative value ::Protobuf::Field::VarintField.encode(value & 0xffff_ffff_ffff_ffff) end end end end
Version data entries
63 entries across 63 versions & 5 rubygems