From: edo@cis.ohio-state.edu (Eric Osborne)
Subject: Re: unaligned access
Date: 1995/05/22 [thread overview]
Message-ID: <3pr23gINN4ru@bumble.cis.ohio-state.edu> (raw)
In-Reply-To: 3plnvd$gks@chomolangma.expersoft.com
I ported a bunch of code, including AT&T's BaseWorX networking software and
the USL ASN.1 compiler, to Digital Alpha platforms a while back. One basic
failing that became fairly quickly evident was the fact that XDR and much
other code really assumes that a long is 32 bits - even if you do the right
thing on the Alpha machine, the receiver will likely munge the whole thing
on the other end. I did the ports under non-disclosure, so I really can't
tell you specifics of how I solved problems in that code, but here's what
I'd do if I were you.
I'd define a set of routines that send a tag (one byte is probably enough)
with your data. Have the tags relate to a set of enumerated values, and
use them as indices into a set of data decoding functions. This has many
merits. For one thing, you can avoid superfluous byte swapping. Tag the
data, and send it unencoded. Let the receiver decode if necessary. With this
technique, you will never have to waste cycles encoding data between machines
with like architectures. For instance, an Intel processor could use data
as-is from an Alpha machine, as long as the word length was appropriate. The
tag can denote anything from strings to 64 bit longs to whatever. I believe
that the DCE encoding routines use a mechanism similar to this.
XDR and many other routines which put data into "network order" actually force
big-endian byte order - the routines are biased in that fashion, and impose
senseless performance penalties on little-endian systems, especially when
communicating with another little-endian system. And, all architecture biases
aside, there are a whole lot more little-endian systems than there are any
thing else, just because of Intel.
Your alignment problem probably stems from some assumption in the code that
it can align objects on 4 byte boundaries. That doesn't work for many
data types on the Alpha machines.
Hope that helps.
Eric Osborne
next prev parent reply other threads:[~1995-05-22 4:00 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
1995-05-20 4:00 unaligned access Adrian Wenden
1995-05-22 4:00 ` Eric Osborne [this message]
1995-05-24 4:00 ` Vepa V Sirish
1995-05-25 4:00 ` John Wood
-- strict thread matches above, loose matches on Subject: below --
2003-03-06 6:27 Unaligned access Emmanuel STAPF [ISE]
2000-03-31 5:00 Kraisit Vittinanon
2000-04-04 4:00 ` Oisin McGuinness
1998-03-31 5:00 Allen M. Cohen
1998-04-01 5:00 ` Joe Mario
1996-11-15 5:00 unaligned access gautam
1996-11-16 5:00 ` Dirk Grunwald
1996-11-20 5:00 ` Jeff Denham
1996-11-22 5:00 ` Curt Smith
1996-11-21 5:00 ` Anthony Berent
1994-02-05 21:21 Stefan Monnier
1994-02-06 9:39 ` Jarkko Hietaniemi
1993-11-30 22:25 Roland Schemers
1993-11-30 23:25 ` Matt Thomas
1993-12-01 12:06 ` Burkhard Neidecker-Lutz
1993-12-07 1:27 ` Jim Hurst
1993-02-23 15:55 Unaligned access Byron Jennings
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox