Module: UInt24 Private
- Defined in:
- lib/diameter/u24.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Methods for handling 24-bit unsigned integers, used for length and Command-Codes but not representable byString#unpack or Array#pack.
Class Method Summary (collapse)
-
+ (Fixnum) from_u8_and_u16(eightb, sixteenb)
private
Generates an unsigned integer from two other unsigned integers (one representing the top 8 bits, one representing the bottom 16 bits).
-
+ ([Fixnum, Fixnum]) to_u8_and_u16(twentyfourb)
private
Converts an unsigned integer to two other unsigned integers (one representing the top 8 bits, one representing the bottom 16 bits).
Class Method Details
+ (Fixnum) from_u8_and_u16(eightb, sixteenb)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Generates an unsigned integer from two other unsigned integers (one representing the top 8 bits, one representing the bottom 16 bits).
14 15 16 |
# File 'lib/diameter/u24.rb', line 14 def self.from_u8_and_u16(eightb, sixteenb) (eightb << 16) + sixteenb end |
+ ([Fixnum, Fixnum]) to_u8_and_u16(twentyfourb)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Converts an unsigned integer to two other unsigned integers (one representing the top 8 bits, one representing the bottom 16 bits).
25 26 27 28 29 |
# File 'lib/diameter/u24.rb', line 25 def self.to_u8_and_u16(twentyfourb) top_eight = twentyfourb >> 16 bottom_sixteen = twentyfourb - (top_eight << 16) [top_eight, bottom_sixteen] end |