Module: Amp::Core::Support::Platform

Defined in:
lib/amp-core/support/platform_utils.rb

Overview

This module is used to set a few constants regarding which OS, implementation, and architecture the user is running.

Constant Summary collapse

OS =
:unknown
IMPL =

maybe there is some better choice here?

:unknown
ARCH =
:unknown
SYSTEM =
{}

Class Method Summary collapse

Class Method Details

.determine_endiannessObject

Figures up the system is running on a little or big endian processor architecture, and upates the SYSTEM[] hash in the Support module.



77
78
79
80
81
82
83
84
85
86
# File 'lib/amp-core/support/platform_utils.rb', line 77

def self.determine_endianness
  num = 0x12345678
  native = [num].pack('l')
  netunpack = native.unpack('N')[0]
  if num == netunpack
    SYSTEM[:endian] = :big
  else
    SYSTEM[:endian] = :little
  end   
end