Sha256: 519186796201afa1f57903753c4bb92e183a0643eafaebd7869391e75c7f31bb

Contents?: true

Size: 627 Bytes

Versions: 24

Compression:

Stored size: 627 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

24 entries across 24 versions & 2 rubygems

Version Path
protobuffy-3.6.0 lib/protobuf/field/sfixed64_field.rb
protobuffy-3.5.1 lib/protobuf/field/sfixed64_field.rb
protobuffy-3.4.0 lib/protobuf/field/sfixed64_field.rb
protobuffy-3.3.0 lib/protobuf/field/sfixed64_field.rb
protobuffy-3.2.0 lib/protobuf/field/sfixed64_field.rb
protobuffy-3.1.0 lib/protobuf/field/sfixed64_field.rb
protobuf-3.3.6 lib/protobuf/field/sfixed64_field.rb
protobuf-3.3.5 lib/protobuf/field/sfixed64_field.rb
protobuf-3.3.4 lib/protobuf/field/sfixed64_field.rb
protobuf-3.3.3 lib/protobuf/field/sfixed64_field.rb
protobuf-3.3.2 lib/protobuf/field/sfixed64_field.rb
protobuf-3.3.1 lib/protobuf/field/sfixed64_field.rb
protobuf-3.3.0 lib/protobuf/field/sfixed64_field.rb
protobuf-3.2.1 lib/protobuf/field/sfixed64_field.rb
protobuf-3.2.0 lib/protobuf/field/sfixed64_field.rb
protobuf-3.1.0 lib/protobuf/field/sfixed64_field.rb
protobuf-3.0.5 lib/protobuf/field/sfixed64_field.rb
protobuf-3.0.4 lib/protobuf/field/sfixed64_field.rb
protobuf-3.0.3 lib/protobuf/field/sfixed64_field.rb
protobuf-3.0.2 lib/protobuf/field/sfixed64_field.rb