Class: BinStruct::Int64

Inherits:
Int
  • Object
show all
Defined in:
lib/bin_struct/int.rb

Overview

8-byte unsigned integer

Author:

  • LemonTree55

Direct Known Subclasses

Int64be, Int64le, Int64n, SInt64

Instance Attribute Summary

Attributes inherited from Int

#default, #endian, #value, #width

Instance Method Summary collapse

Methods inherited from Int

#format_inspect, #from_human, #nbits, #read, #sz, #to_f, #to_i, #to_s

Methods included from Structable

#format_inspect, #read, #sz, #to_human, #to_s, #type_name

Constructor Details

#initialize(options = {}) ⇒ Int64

Returns a new instance of Int64.

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :value (Integer)
  • :endian (:big, :little, :native)


411
412
413
414
415
416
417
# File 'lib/bin_struct/int.rb', line 411

def initialize(options = {})
  opts = options.slice(:value, :endian)
  opts[:endian] ||= :big
  opts[:width] = 8
  super(opts)
  @packstr = { big: 'Q>', little: 'Q<', native: 'Q' }
end