Class: BinStruct::SInt32

Inherits:
Int32 show all
Defined in:
lib/bin_struct/int.rb

Overview

4-byte signed integer

Author:

  • LemonTree55

Direct Known Subclasses

SInt32be, SInt32le, SInt32n

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 = {}) ⇒ SInt32

Returns a new instance of SInt32.

Parameters:

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

Options Hash (options):

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


366
367
368
369
370
# File 'lib/bin_struct/int.rb', line 366

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