Don't mix bytes and bits here. There's no big or little endian in a char or any single byte data type.
Here's how you check for it on Linux:
#include <stdio.h>
int
main(int argc, char **argv)
{
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
printf("little endian\n");
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
printf("big endian\n");
#endif
return (0);
}
No comments:
Post a Comment