TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Pascal Schmidt
from: Bo Simonsen
date: 2004-01-24 16:42:06
subject: Re: Big endian machines

PS> Hi Bo! :-)

Hi Pascal,

 PS>> Or do something like this:

 PS>> void swap16(uint16_t *orig)
 PS>> {
 PS>>     uint8_t x,y;

 PS>>     x = *(uint8_t *) orig;
 PS>>     y = *(((uint8_t *) orig)+1);

 PS>>     *orig = x + y * 256;
 PS>> }

 PS>> That should work on both big and little endian machines, if *orig is
 PS>> read from disk and is stored there in little endian byteorder.

 BS> Aha smart!

 PS> Best try it on a big endian machine first, though, I 
 PS> didn't actually try to compile or run this piece of 
 PS> code. I don't even know if it works on a little endian 
 PS> machine. It should, but I may have made mistakes.

The problem is that I right now doesn't have access to a big endian machine
so i'm kinda lost with it.

But I could try implement the macros and see if somebody who owns a big
endian machine could use the software, without problems.

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™.