TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Pascal Schmidt
from: Bo Simonsen
date: 2004-01-19 14:36:12
subject: Re: Big endian machines

PS> Hi Bo! :-)

Hi Pascal,

 BS> #define get_dword(ptr) \
 BS>   ((dword)((byte)(ptr)[0]) | \
 BS>   (((dword)((byte)(ptr)[1])) << 8) | \
 BS>   (((dword)((byte)(ptr)[2])) << 16) | \
 BS>   (((dword)((byte)(ptr)[3])) << 24))

 BS> #define get_word(ptr) \
 BS>   (word) ((word)((byte)(ptr)[0]) | \
 BS>   (((word)((byte)(ptr)[1])) << 8 ))

 BS> For big endian?

 PS> Ugh. Just store stuff in network order (big endian) and 
 PS> use htonl and friends to convert to host byte order.

 PS>     man 3 htonl

Ahh I did help thanks :)

Bo


--- Maximus/UNIX 3.03b
* Origin: The Night Express - Roennede, Dk (2:236/100)
SEEN-BY: 633/267 270
@PATH: 236/100 237/9 20/11 106/1 2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.