Another endian question

hello,

…I’ve been happily swapping bytes with SDL_SwapLE16 & 32, but have
come across some char’s that apparently need to be swapped…I’ve
assumed that they are smaller than 16 bits, so does anyone have
macros for swapping 8 or 4 bit values?

tanx,
jamie

hello,

…I’ve been happily swapping bytes with SDL_SwapLE16 & 32, but have
come across some char’s that apparently need to be swapped…I’ve
assumed that they are smaller than 16 bits, so does anyone have
macros for swapping 8 or 4 bit values?

…and to be a bit more specific, the program I’m porting does alot
of reading in of structs: in this case it’s:

typedef struct font_kern_pair {
char c1,c2;
signed char offset;
} font_kern_pair;

…so it seems to me that this wouldn’t allow the application of the
SDL_endian.h macros…am I wrong?

tanx,
jamie

At 12:31 PM 8/16/02 -0400, you wrote:

hello,

…I’ve been happily swapping bytes with SDL_SwapLE16 & 32, but have come
across some char’s that apparently need to be swapped…I’ve assumed that
they are smaller than 16 bits, so does anyone have macros for swapping 8
or 4 bit values?

…and to be a bit more specific, the program I’m porting does alot of
reading in of structs: in this case it’s:

typedef struct font_kern_pair {
char c1,c2;
signed char offset;
} font_kern_pair;

…so it seems to me that this wouldn’t allow the application of the
SDL_endian.h macros…am I wrong?

Endianness refers to the byte-order in integers. Two bytes together, as in
a struct, that is never treated as an integer should not (to my knowledge,
anyway) be swapped at all by the endianness of a platform.

But I’m probably wrong.–
“It startled him even more when just after he was awarded the Galactic
Institute’s Prize for Extreme Cleverness he got lynched by a rampaging mob
of respectable physicists who had finally realized that the one thing they
really couldn’t stand was a smart-ass.”
– Hitchhiker’s Guide to the Galaxy

hello,

…I’ve been happily swapping bytes with SDL_SwapLE16 & 32, but have
come across some char’s that apparently need to be swapped…I’ve
assumed that they are smaller than 16 bits, so does anyone have
macros for swapping 8 or 4 bit values?

tanx,
jamie

endiness isn’t about swaping bits but bytes! (if i am well informed) so
this question is imho irrelevant.