Class: StructFu::Int64

Inherits:
Int show all
Defined in:
lib/packetfu/structfu.rb

Overview

Int64 is a eight byte value.

Direct Known Subclasses

Int64be, Int64le

Instance Attribute Summary

Attributes inherited from Int

#default, #endian, #value, #width

Instance Method Summary collapse

Methods inherited from Int

#read, #to_f, #to_i

Methods inherited from Struct

#force_binary

Constructor Details

#initialize(v = nil, e = :big) ⇒ Int64

Returns a new instance of Int64.



170
171
172
173
# File 'lib/packetfu/structfu.rb', line 170

def initialize(v=nil, e=:big)
  super(v, e, w=4)
  @packstr = (self.e == :big) ? 'Q>' : 'Q<'
end

Instance Method Details

#to_sObject

Returns a eight byte value as a packed string.



176
177
178
179
# File 'lib/packetfu/structfu.rb', line 176

def to_s
  @packstr = (self.e == :big) ? 'Q>' : 'Q<'
  [(self.v || self.d)].pack(@packstr)
end