Re: [SLUG] [PIG] Guess That Function #1

From: Dylan William Hardison (dylanwh@gmail.com)
Date: Mon May 01 2006 - 22:19:43 EDT


On 5/1/06, Paul M Foster <paulf@quillandmouse.com> wrote:
> Okay, I'll bite. I assume the "what" you're talking about in the
> sentence above is the platform, either Intel or (older) Mac (and some
> other chips). It appears that the function returns the "first" byte (as
> a character) of the number assigned to the variable "one". I'm not sure,
> but I'm guessing that on an Intel box, it would return a 0, and on a big
> endian platform, it would return a 1. So you might be able to say that
> this function can tell the user the endianness of a box.
>
> But then again, I could be completely wrong. ;-}

You're right! I use it an autoconf replacement I'm writing,
as am_big_endian(). To test the endianness of a system.

It's a lot more reliable than SDL_BYTEORDER, which relies on the
system name for the endianness. which is stupid.

-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 18:32:36 EDT