1993.08.17 00:06 "byte swapping 16- and 32-bit data", by Sam Leffler

1993.08.18 19:11 "Re: byte swapping 16- and 32-bit data", by Sam Leffler

  1. Sam A: you get correct data for files written on a similar machine and byte-swapped data for files written on a machine of the opposite byte-order. A routine is provided to check whether or not you need to fix up the data.

    Me B: you always get correct data no matter where the file was written. The speed for files written on a similar machine is the same as above. There is a minor performance hit for files written on a machine of the opposite byte-order.

The performance issue is the crux of the matter. If a separate pass is made of data just to do byte swapping, it will be noticed; through not for small images.

I also suggested that if performance is enough of an issue, you could add an option to toggle between approaches A and B. Sam has strongly nixed the option. (Fine with me.) It does sound like he is implementing approach B.

I've made mods to the library to do byte-swapping after data is decoded. The mods were done in such a way that the compression routines can override the default behaviour if they are changed to roll the byte-swap work in with the decoding. I did not provide a client interface to control this because I believe that it's important for the library to maintain a consistent interface. If the performance hit is too large, then I'll revisit this decision in a later release.

Sam