Class: Rumai::IXP::Struct::Integer8Field

Inherits:
Field show all
Defined in:
lib/rumai/ixp/message.rb

Overview

A field whose value is a 8-byte integer.

Instance Attribute Summary

Attributes inherited from Field

#countee, #counter, #format, #name

Instance Method Summary collapse

Methods inherited from Field

factory, #initialize, #load_9p, #to_9p

Constructor Details

This class inherits a constructor from Rumai::IXP::Struct::Field

Instance Method Details

#value_from_9p(stream) ⇒ Object



300
301
302
# File 'lib/rumai/ixp/message.rb', line 300

def value_from_9p stream
  stream.read_9p(4) | (stream.read_9p(4) << BYTE4_BITS)
end

#value_to_9p(value) ⇒ Object



294
295
296
297
298
# File 'lib/rumai/ixp/message.rb', line 294

def value_to_9p value
  v = value.to_i
  (BYTE4_MASK & v).to_9p(4) <<               # lower bytes
  (BYTE4_MASK & (v >> BYTE4_BITS)).to_9p(4)  # higher bytes
end