> Sorry, I don't understand what changes you are suggesting. That code
> seems to be in tu_types.h already.
He wasn't suggesting that you adopt his hack. I advised him to do a
cheap hack to get it running, then let the maintainers figure out the
"right" way.
> Can you suggest a way to automatically detect endianness on your box
> so that we can make a patch that will also work everywhere else?
My suggestion is that the code should not be depending on host byte
order. It should just do the right thing regardless of the host byte
order. We did this at Cygnus and it simplified a lot of code. Rather
than picking up a field and then conditionally trying to "swap" it,
just pick it up correctly, based on the field's big/little endianness:
uint32_t
read_le32() {
uint32_t u;
unsigned char buf[4];
m_read (buf, 4, m_data)
u = buf[0] + // pointer points to the "little" end
(buf[1] << 8) +
(buf[2] << 16) +
(buf[3] << 24); // "big" end is a few bytes away
return u;
}
Then you can throw away all the conditional compilation stuff. We measured
the speed at Cygnus and it made <1% difference (plus or minus), e.g. in
the linker, which reads and writes a LOT of binary fields.
John
_______________________________________________
Gnash-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnash-dev