getting the bytes of a long

Stewart Gordon smjg_1998 at yahoo.com
Thu Dec 6 18:56:27 PST 2007


"Jason House" <jason.james.house at gmail.com> wrote in message 
news:fipgc3$5ni$1 at digitalmars.com...
<snip>
> Does gdc run on any little endian machines?  I'm not sure which way arrays
> grow on such machines, but I think this could would give the reverse byte
> order of a big endian machine.

Array indexes always follow the sign convention of memory addresses.  The 
basic difference between big-endian and little-endian machines is which way 
the bytes of a number go relative to this sign convention.  So yes.

As such, accessing an integer as an array of bytes is a common technique for 
converting between little-endian and big-endian byte orders.

Stewart.

-- 
My e-mail address is valid but not my primary mailbox.  Please keep replies 
on the 'group where everybody may benefit. 



More information about the Digitalmars-d-learn mailing list