| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Big endian machines |
BS> Could someone please give me a advice of what I should keep in BS> mind, then I won't to write Endian-less software? JB> in the past JB> The most straight-forward way was when reading and JB> writiing integers, floats JB> etc process them a character at a time. JB> another way is to make a function that reverses the bytes in the number JB> and use that before writing and after reading... JB> Then you arrange things so that when the edianness of the data file JB> matches that of the CPU that then the byte-shuffle routine doesn't JB> run. Yes, JB> there's two ways to do that too. JB> One is to always use the same endian-ness in the data file and if JB> compiling on correctly endian hardware #define an empty macro to JB> leave the bytes alone JB> some environments (eg POSIX) provide htonl() etc which does this for JB> you. Yes I did see, and now I understand what host byte order and network byte order is :) JB> The other is to have the software detect the endianness of the data JB> file and set a flag which youv'e implemented to switch the JB> byte-swapping on or off at runtime. Like I showed from the husky project? 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™.