Very tricksie of you! I'm always amazed at how your mind operates.
TwP
···
On 10/24/06, ara.t.howard@noaa.gov <ara.t.howard@noaa.gov> wrote:
On Wed, 25 Oct 2006, Tim Pease wrote:
> Does ruby provide a global or a method call to determine the endianess
> of the underlying platform?
>
> This is what I cooked up, but I'm wondering if there is a ruby way of
> doing this.
>
> BIG_ENDIAN = [0xFF00].pack('S') == [0xFF00].pack('n')
>
> Blessings,
> TwP
Kinky. Is it a bug, or a hack intended to make PowerPCs look like Intel
chips?
···
On 11/15/06, Eric Hodel <drbrain@segment7.net> wrote:
On Oct 24, 2006, at 4:40 PM, Tim Pease wrote:
> Does ruby provide a global or a method call to determine the endianess
> of the underlying platform?
>
> This is what I cooked up, but I'm wondering if there is a ruby way of
> doing this.
>
> BIG_ENDIAN = [0xFF00].pack('S') == [0xFF00].pack('n')
Beware, some versions of ruby shipped with OS X have a broken pack
where the endianness is swapped.
On 11/16/06, Francis Cianfrocca <garbagecat10@gmail.com> wrote:
On 11/15/06, Eric Hodel <drbrain@segment7.net> wrote:
>
> On Oct 24, 2006, at 4:40 PM, Tim Pease wrote:
>
> > Does ruby provide a global or a method call to determine the endianess
> > of the underlying platform?
> >
> > This is what I cooked up, but I'm wondering if there is a ruby way of
> > doing this.
> >
> > BIG_ENDIAN = [0xFF00].pack('S') == [0xFF00].pack('n')
>
> Beware, some versions of ruby shipped with OS X have a broken pack
> where the endianness is swapped.
Kinky. Is it a bug, or a hack intended to make PowerPCs look like Intel
chips?
Yes. Apple cross-compiled ruby from Intel to PPC and Ruby assumes the source and target architectures have the same endianness.
···
On Nov 16, 2006, at 5:42 AM, Austin Ziegler wrote:
On 11/16/06, Francis Cianfrocca <garbagecat10@gmail.com> wrote:
On 11/15/06, Eric Hodel <drbrain@segment7.net> wrote:
> Beware, some versions of ruby shipped with OS X have a broken pack
> where the endianness is swapped.
Kinky. Is it a bug, or a hack intended to make PowerPCs look like Intel
chips?
Bug. It was fixed in a later OS update, IIRC.
--
Eric Hodel - drbrain@segment7.net - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant
On Nov 16, 2006, at 5:42 AM, Austin Ziegler wrote:
Bug. It was fixed in a later OS update, IIRC.
Yes. Apple cross-compiled ruby from Intel to PPC and Ruby assumes the source and target architectures have the same endianness.
Sounds like a bug in Ruby's build to me...
--
Charles Oliver Nutter, JRuby Core Developer
Blogging on Ruby and Java @ headius.blogspot.com
Help spec out Ruby today! @ Welcome to headius.com
headius@headius.com -- charles.nutter@sun.com