| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Re: Big endian machines |
Hi Rob, -=> Rob Swindell wrote to Bo Simonsen <=- > Could someone please give me a advice of what I should keep in mind, > then I won't to write Endian-less software? RS> I would recommend storing integers on disk in ASCII rather than binary. RS> A 32-bit integer stored as 8 hex characters will take up twice the RS> storage space as the binary equivalent, but it will have no endian RS> issues. It's kinda hard to that with Fidonet packages. As I wrote to pascal I know that you need to do some bit-shifting to read a packed structure written by a little endian machine into a big endian machine. RS> If you are going to store integers on disk in binary (for storage or RS> performance reasons), then you will need to use intelligent macros to RS> convert to/from the native integer format for some platforms. Exactly like: #define get_dword(ptr) \ ((dword)((byte)(ptr)[0]) | \ (((dword)((byte)(ptr)[1])) << 8) | \ (((dword)((byte)(ptr)[2])) << 16) | \ (((dword)((byte)(ptr)[3])) << 24)) #define get_word(ptr) \ (word) ((word)((byte)(ptr)[0]) | \ (((word)((byte)(ptr)[1])) << 8 )) For big endian? Bo ... Computer Hacker wanted. Must have own axe. ___ MultiMail/Linux v0.46 --- 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™.