[Python-Dev] New Unicode Snapshot

M.-A. Lemburg mal@lemburg.com
Tue, 08 Feb 2000 15:18:58 +0100


Tim Peters wrote:
> 
> [M.-A. Lemburg]
> > ...
> > Also new in this snapshot is configuration code which figures
> > out the byte order on the installation machine... I looked
> > everywhere in the Python source code but couldn't find any
> > hint whether this was already done in some place,
> 
> There's a tiny bit of inline code for this in the "host byte order" case of
> structmodule.c's function whichtable.  It's easy to figure out, so probably
> better to copy that than create new ifdef symbols for autoconf to screw up
> <wink>.

I looked there, but only found that it uses native byte order
by means of "letting the compiler do the right thing" -- there
doesn't seem to be any code which actually tests for it.

The autoconf stuff is pretty simple, BTW. The following code
is used for the test:

main() {
 long x = 0x34333231; /* == "1234" on little endian machines */
 char *y = (char *)&x;
 if (strncmp(y,"1234",4))
  exit(0); /* big endian */
 else
  exit(1); /* little endian */
}

This should be ok on big endian machines... even though I
haven't tested it due to lack of access to such a beast.

-- 
Marc-Andre Lemburg
______________________________________________________________________
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/