Sha256: 47d8ae130381cf95d5749d9eb2420ba60572d28cd2092af772e8864b0b6a2e41

Contents?: true

Size: 626 Bytes

Versions: 73

Compression:

Stored size: 626 Bytes

Contents

require 'protobuf/field/int64_field'

module Protobuf
  module Field
    class Sfixed64Field < Int64Field

      ##
      # Public Instance Methods
      #

      def decode(bytes)
        values = bytes.unpack('VV') # 'Q' is machine-dependent, don't use
        value  = values[0] + (values[1] << 32)
        value -= 0x1_0000_0000_0000_0000 if (value & 0x8000_0000_0000_0000).nonzero?
        value
      end

      def encode(value)
        [value & 0xffff_ffff, value >> 32].pack('VV') # 'Q' is machine-dependent, don't use
      end

      def wire_type
        ::Protobuf::WireType::FIXED64
      end

    end
  end
end

Version data entries

73 entries across 73 versions & 6 rubygems

Version Path
protobuf-cucumber-3.10.4 lib/protobuf/field/sfixed64_field.rb
protobuf-3.10.3 lib/protobuf/field/sfixed64_field.rb
protobuf-3.10.2 lib/protobuf/field/sfixed64_field.rb
protobuf-3.10.1 lib/protobuf/field/sfixed64_field.rb
protobuf-3.10.0 lib/protobuf/field/sfixed64_field.rb
protobuf-3.10.0.pre0 lib/protobuf/field/sfixed64_field.rb
protobuf-3.9.0 lib/protobuf/field/sfixed64_field.rb
protobuf-3.9.0.pre2 lib/protobuf/field/sfixed64_field.rb
protobuf-3.9.0.pre lib/protobuf/field/sfixed64_field.rb
protobuf-3.8.5 lib/protobuf/field/sfixed64_field.rb
protobuf-3.8.5.pre0 lib/protobuf/field/sfixed64_field.rb
protobuf-3.8.4 lib/protobuf/field/sfixed64_field.rb
protobuf-3.8.3 lib/protobuf/field/sfixed64_field.rb
protobuf-3.8.2 lib/protobuf/field/sfixed64_field.rb
protobuf-3.8.1 lib/protobuf/field/sfixed64_field.rb
protobuf-3.8.0 lib/protobuf/field/sfixed64_field.rb
protobuf-3.8.0.pre1 lib/protobuf/field/sfixed64_field.rb
protobuf-core-3.5.0 lib/protobuf/field/sfixed64_field.rb
protobuf-3.7.5 lib/protobuf/field/sfixed64_field.rb
protobuf-3.7.4 lib/protobuf/field/sfixed64_field.rb