1
0
Fork 0
flightgear/Hints/endian-ness

72 lines
3 KiB
Text
Raw Normal View History

1999-04-05 21:32:32 +00:00
From fatcity!root@news.cts.com Fri May 15 08:52:18 1998
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
["1426" "Fri" "15" "May" "1998" "06:30:53" "-0800" "Steve Baker" "sbaker@link.com" nil "39" "Re: Endian swapping" "^From:" nil nil "5" nil nil nil nil nil]
nil)
Received: from mh2.cts.com (root@mh2.cts.com [205.163.24.68])
by meserv.me.umn.edu (8.8.8/8.8.8) with ESMTP id IAA18883
for <curt@me.umn.edu>; Fri, 15 May 1998 08:52:18 -0500 (CDT)
Received: from king.cts.com (root@king.cts.com [198.68.168.21]) by mh2.cts.com (8.8.7/8.8.5) with ESMTP id GAA12800; Fri, 15 May 1998 06:52:14 -0700 (PDT)
Received: from donews.cts.com (root@donews.cts.com [192.188.72.21])
by king.cts.com (8.8.7/8.8.7) with SMTP id GAA18786;
Fri, 15 May 1998 06:52:13 -0700 (PDT)
Received: from fatcity by donews.cts.com with uucp
(Smail3.1.29.1 #5) id m0yaKtA-00001sa; Fri, 15 May 98 06:51 PDT
Received: by fatcity.com (10-Feb-1998/v1.0f-b64/bab) via UUCP id 00027B2C; Fri, 15 May 1998 06:30:53 -0800
Message-ID: <F001.00027B2C.19980515063053@fatcity.com>
X-Comment: OpenGL Game Developers Mailing List
X-Sender: Steve Baker <sbaker@link.com>
Reply-To: OPENGL-GAMEDEV-L@fatcity.com
Errors-To: ML-ERRORS@fatcity.com
Organization: Fat City Network Services, San Diego, California
X-ListServer: v1.0f, build 64; ListGuru (c) 1996-1998 Bruce A. Bergman
Precedence: bulk
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Content-Transfer-Encoding: 7bit
From: Steve Baker <sbaker@link.com>
Sender: root@fatcity.com
To: Multiple recipients of list OPENGL-GAMEDEV-L <OPENGL-GAMEDEV-L@fatcity.com>
Subject: Re: Endian swapping
Date: Fri, 15 May 1998 06:30:53 -0800
On Fri, 15 May 1998, Sean L. Palmer wrote:
> I'm trying to make this library as cross-platform as humanly possible with
> my limited resources, so if anyone has any code to detect whether the target
> is Big- or Little-endian, please e-mail it my way.
/*
Return TRUE if this machine is little endian,
FALSE otherwise.
*/
int is_little_endian ()
{
int i = 1 ;
return *((char *) &i) ;
}
...this works because the address of an integer on a little-endian machine is
the address of the low order byte (whose value is 1) and on a big-endian machine,
it's the address of the high order byte (whose value is 0).
Steve Baker (817)619-8776 (Vox/Vox-Mail)
Raytheon Systems Inc. (817)619-4028 (Fax)
Work: SBaker@link.com http://www.hti.com
Home: SJBaker1@airmail.net http://web2.airmail.net/sjbaker1
--
Author: Steve Baker
INET: sbaker@link.com
Fat City Network Services -- (619) 538-5051 FAX: (619) 538-5051
San Diego, California -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru@fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB OPENGL-GAMEDEV-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).