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

Hi Bo.

20-Jan-04 02:53:04, Bo Simonsen wrote to Pascal Schmidt

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

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

 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?

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

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

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

 -=> Bye <=-

---
* Origin: Bad karma, yea Way bad karma.. (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™.