Simpler endianness tester.

pull/15/head
Jussi Pakkanen 12 years ago
parent 919fcbb6ef
commit cd9475bfe5
  1. 10
      test cases/26 endian/prog.c

@ -1,12 +1,10 @@
#include<stdint.h>
int is_big_endian(void) {
union {
uint32_t i;
char c[4];
} bint = {0x01020304};
return bint.c[0] == 1;
uint32_t one = 1;
if(*((uint8_t*) &one) == 1)
return 0;
return 1;
}

Loading…
Cancel
Save