diff options
Diffstat (limited to 'src/tests/mkeystash_compat/bigendian.c')
-rw-r--r-- | src/tests/mkeystash_compat/bigendian.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/tests/mkeystash_compat/bigendian.c b/src/tests/mkeystash_compat/bigendian.c new file mode 100644 index 0000000..bcdeeb5 --- /dev/null +++ b/src/tests/mkeystash_compat/bigendian.c @@ -0,0 +1,17 @@ +#include <stdio.h> + +/* + * Test to see if system is bigendian + * Returns 0 if it is big endian + * 1 if it is little endian + */ +int main() +{ + int int_var = 1; + unsigned char *char_array = (unsigned char*)&int_var; + + if (char_array[0] == 0) + return 0; /* big endian */ + else + return 1; /* little endian */ +} |