TestEndianess.c.in 871 B

1234567891011121314151617181920212223
  1. /* A 16 bit integer is required. */
  2. typedef @CMAKE_16BIT_TYPE@ cmakeint16;
  3. /* On a little endian machine, these 16bit ints will give "THIS IS LITTLE ENDIAN."
  4. On a big endian machine the characters will be exchanged pairwise. */
  5. const cmakeint16 info_little[] = {0x4854, 0x5349, 0x4920, 0x2053, 0x494c, 0x5454, 0x454c, 0x4520, 0x444e, 0x4149, 0x2e4e, 0x0000};
  6. /* on a big endian machine, these 16bit ints will give "THIS IS BIG ENDIAN."
  7. On a little endian machine the characters will be exchanged pairwise. */
  8. const cmakeint16 info_big[] = {0x5448, 0x4953, 0x2049, 0x5320, 0x4249, 0x4720, 0x454e, 0x4449, 0x414e, 0x2e2e, 0x0000};
  9. #ifdef __CLASSIC_C__
  10. int main(argc, argv) int argc; char *argv[];
  11. #else
  12. int main(int argc, char *argv[])
  13. #endif
  14. {
  15. int require = 0;
  16. require += info_little[argc];
  17. require += info_big[argc];
  18. (void)argv;
  19. return require;
  20. }