Class: DHCP::OptSInt32
- Defined in:
- lib/dhcp/options.rb
Overview
Class for four-byte signed integer value DHCP options
Instance Attribute Summary
Attributes inherited from OptData
Attributes inherited from Opt
Instance Method Summary collapse
-
#bin_to_data(data) ⇒ Object
Convert unsigned form back to signed data.
-
#data_to_bin(data) ⇒ Object
Convert signed data to unsigned form.
Methods inherited from OptInt8
Methods inherited from OptFixedData
Methods inherited from OptData
#get, #initialize, #opt_header, #set, #to_opt, #to_s
Methods inherited from Opt
#initialize, #opt_header, #to_opt, #to_s
Constructor Details
This class inherits a constructor from DHCP::OptFixedData
Instance Method Details
#bin_to_data(data) ⇒ Object
Convert unsigned form back to signed data
491 492 493 |
# File 'lib/dhcp/options.rb', line 491 def bin_to_data(data) (super(data) + 2**31) % 2**32 - 2**31 end |
#data_to_bin(data) ⇒ Object
Convert signed data to unsigned form
486 487 488 |
# File 'lib/dhcp/options.rb', line 486 def data_to_bin(data) super(data % 2**32) end |