| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Re: Big endian machines |
Hi Bo! :-)
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?
Ugh. Just store stuff in network order (big endian) and use htonl and
friends to convert to host byte order.
man 3 htonl
Ciao
Pascal
--- Msged/LNX 6.1.1
* Origin: Linux FAQ - http://www.tzi.de/~pharao90/faq/ (1:153/401.2)SEEN-BY: 633/267 270 @PATH: 153/401 307 140/1 106/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™.