projects
/
fio.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
fio: construct options from gui
[fio.git]
/
endian_check.c
1
#include <stdint.h>
2
#include "os/os.h"
3
4
int endian_check(void)
5
{
6
union {
7
uint8_t c[8];
8
uint64_t v;
9
} u;
10
int le = 0, be = 0;
11
12
u.v = 0x12;
13
if (u.c[7] == 0x12)
14
be = 1;
15
else if (u.c[0] == 0x12)
16
le = 1;
17
18
#if defined(FIO_LITTLE_ENDIAN)
19
if (be)
20
return 1;
21
#elif defined(FIO_BIG_ENDIAN)
22
if (le)
23
return 1;
24
#else
25
return 1;
26
#endif
27
28
if (!le && !be)
29
return 1;
30
31
return 0;
32
}
33