| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Big endian machines |
Hi Bo. 15-Jan-04 02:06:14, Bo Simonsen wrote to All BS> Hey All! 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? in the past The most straight-forward way was when reading and writiing integers, floats etc process them a character at a time. another way is to make a function that reverses the bytes in the number and use that before writing and after reading... Then you arrange things so that when the edianness of the data file matches that of the CPU that then the byte-shuffle routine doesn't run. there's two ways to do that too. One is to always use the same endian-ness in the data file and if compiling on correctly endian hardware #define an empty macro to leave the bytes alone some environments (eg POSIX) provide htonl() etc which does this for you. The other is to have the software detect the endianness of the data file and set a flag which youv'e implemented to switch the byte-swapping on or off at runtime. -=> Bye <=- ---* Origin: Darth Vader sleeps with a Teddywookie. (3:640/1042) SEEN-BY: 633/267 270 @PATH: 640/1042 531 954 774/605 123/500 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™.