Method: BinStruct::Int24#to_s

Defined in:
lib/bin_struct/int.rb

#to_s::String

Returns:

  • (::String)

Author:

  • Sylvain Daubert (2016-2024)



274
275
276
277
278
279
280
281
282
# File 'lib/bin_struct/int.rb', line 274

def to_s
  up8 = to_i >> 16
  down16 = to_i & 0xffff
  if @endian == :big
    [up8, down16].pack('Cn')
  else
    [down16, up8].pack('vC')
  end
end