obilittlebigman.c 638 Bytes
Newer Older
1 2 3 4 5 6 7 8 9
/****************************************************************************
 * Code for endianness checking                                             *
 ****************************************************************************/

/**
 * @file obilittlebigman.c
 * @author Eric Coissac (eric.coissac@metabarcoding.org)
 * @date 23 May 2015
 * @brief Code endianness checking.
10 11
 */

12
#include "obilittlebigman.h"
13

14

15
// TODO this function does not seem to work properly
16
bool obi_is_little_endian() {
17 18 19 20 21 22 23 24 25
    union { int entier;
            char caractere[4] ;
    } test;

    test.entier=0x01020304;

    return (test.caractere[3] == 1);
}