Sha256: 3f5b7c24d4f2a14cbff3d8d89d3ff907300a0cab8f3a39e03bca6357c9060dc8
Contents?: true
Size: 1.26 KB
Versions: 3
Compression:
Stored size: 1.26 KB
Contents
#:title: ByteOrder #-- # ByteOrder # v 1.0 # # Copyright (c) 2003 Michael Neumann # # $Id: byteorder.rb,v 1.0 2005/04/28 03:10:10 transami Exp $ # # ========================================================================== # Revision History :: # YYYY.MM.DD Ver. Dev. Description # -------------------------------------------------------------------------- # 2005.04.28 1.0 TO Minor modifications to documentation. # ========================================================================== #++ # = Description # # To do. # # == Usage # # To do. # # == Author(s) # # * Michael Neumann # module ByteOrder VERSION = '1.0.0' Native = :Native BigEndian = Big = Network = :BigEndian LittleEndian = Little = :LittleEndian # examines the byte order of the underlying machine def byte_order if [0x12345678].pack("L") == "\x12\x34\x56\x78" BigEndian else LittleEndian end end alias byteorder byte_order def little_endian? byte_order == LittleEndian end def big_endian? byte_order == BigEndian end alias little? little_endian? alias big? big_endian? alias network? big_endian? module_function :byte_order, :byteorder module_function :little_endian?, :little? module_function :big_endian?, :big?, :network? end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
facets-0.7.0 | lib/facet/byteorder.rb |
facets-0.7.1 | lib/facet/byteorder.rb |
facets-0.7.2 | lib/facet/byteorder.rb |