Skip to content
Snippets Groups Projects
Commit 4a7598df authored by Marco van Oort's avatar Marco van Oort
Browse files

Change endianness detection to a variant that does not trigger a compiler warning.

parent 7626162d
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@ NOTA BENE: Symmetry settings are currently discarded!
*/
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <memory.h>
#include <math.h>
#include <Mondriaan.h>
......@@ -237,12 +238,15 @@ int main(int argc, char **argv) {
struct sparsematrix A;
int i;
/* Check endian-ness. This may trigger a compiler warning. */
/* Check endian-ness. */
if (TRUE)
{
unsigned char Test[2] = {1, 0};
if (*((short *)Test) != 1) {
union {
uint32_t i;
uint8_t c[4];
} testInt = {0x01020304};
if(testInt.c[0] == 1) {
fprintf(stderr, "main(): This is a big-endian system.\n");
IsLittleEndian = FALSE;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment