TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Jasen Betts
from: Bo Simonsen
date: 2004-01-23 17:04:06
subject: Re: Big endian machines

-=> Jasen Betts wrote to Bo Simonsen <=-

 BS>> The structure contains most words and a couple of bytes.
 PS>> What is an sword supposed to be? I'd stick to standard names.

 BS> signed words afair. Anyhow it has the same lenght as a word have,
 BS> which is 2 bytes..

 JB> No, word doesnt mean or 16 bits or even two bytes, except it a few
 JB> limited contexts, it other contexts it can mean larger or smaller sized
 JB> objects.

What does a word then mean? In my context it means 2 bytes (or Max's 
context).

 BS> I should be little endian, fidonet packages should be send in
 BS> little endian, so I guess I just run a htonl on the words?

 JB> no, that'll break it, because "net" format is big endian, also the
 JB> wrong size and direction.  size and direction should be ntohs()
 JB> (net-to-host-short)

Ah yes Okay.

 JB> but that still wants a big endian number fido format is little endian.
 JB> you could swap the bytes and then do ntohs after reading and do
 JB> htons and theb swap the bytes after writing.

I see.

 JB> code that did that would run on both big and little, (and middle)
 JB> endian hardware without modification. (assuming yuo can also define the
 JB> file format in a compatible way)

I see..

Bo

... What is mind? No matter! What is matter? Never mind! - Homer S.
___ 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™.