How to check endianess using ruby?

Hi,

What's the right way to check the endianess(big/little endian) of the machine
on which the ruby code run?

Thanks
Jan

···

--
jan=callcc{|jan|jan};jan.call(jan)

Hi,

···

2008/12/19 Xie Hanjian <jan.h.xie@gmail.com>:

Hi,

What's the right way to check the endianess(big/little endian) of the machine
on which the ruby code run?

[1].pack('S')[0]==1 ? 'little' : 'big'

Regards,
Park Heesob

* Heesob Park <phasis@gmail.com> [2008-12-19 14:02:41 +0900]:

Hi,

> Hi,
>
> What's the right way to check the endianess(big/little endian) of the machine
> on which the ruby code run?
>
[1].pack('S')[0]==1 ? 'little' : 'big'

cool thanks :slight_smile:

···

2008/12/19 Xie Hanjian <jan.h.xie@gmail.com>:

Regards,
Park Heesob

--
jan=callcc{|jan|jan};jan.call(jan)