module Platform::ByteOrder

Copyright © 2003 Michael Neumann

Constants

BigEndian
LittleEndian
Native

Public Class Methods

big?()
Alias for: big_endian?
big_endian?() click to toggle source
# File lib/more/facets/platform.rb, line 225
def big_endian?
  byte_order == BigEndian
end
Also aliased as: big?, network?
byte_order() click to toggle source

examines the byte order of the underlying machine

# File lib/more/facets/platform.rb, line 211
def byte_order
  if [0x12345678].pack("L") == "\x12\x34\x56\x78"
    BigEndian
  else
    LittleEndian
  end
end
Also aliased as: byteorder
byteorder()
Alias for: byte_order
little?()
Alias for: little_endian?
little_endian?() click to toggle source
# File lib/more/facets/platform.rb, line 221
def little_endian?
  byte_order == LittleEndian
end
Also aliased as: little?
network?()
Alias for: big_endian?

Private Instance Methods

big?()
Alias for: big_endian?
big_endian?() click to toggle source
# File lib/more/facets/platform.rb, line 225
def big_endian?
  byte_order == BigEndian
end
Also aliased as: big?, network?
byte_order() click to toggle source

examines the byte order of the underlying machine

# File lib/more/facets/platform.rb, line 211
def byte_order
  if [0x12345678].pack("L") == "\x12\x34\x56\x78"
    BigEndian
  else
    LittleEndian
  end
end
Also aliased as: byteorder
byteorder()
Alias for: byte_order
little?()
Alias for: little_endian?
little_endian?() click to toggle source
# File lib/more/facets/platform.rb, line 221
def little_endian?
  byte_order == LittleEndian
end
Also aliased as: little?
network?()
Alias for: big_endian?