diff options
Diffstat (limited to 'util/cbfstool/common.c')
-rw-r--r-- | util/cbfstool/common.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/util/cbfstool/common.c b/util/cbfstool/common.c index 3394b7b536..d4560f691f 100644 --- a/util/cbfstool/common.c +++ b/util/cbfstool/common.c @@ -27,6 +27,19 @@ #include "cbfs.h" #include "elf.h" +/* Utilities */ + +/* Small, OS/libc independent runtime check for endianess */ +int is_big_endian(void) +{ + static const uint32_t inttest = 0x12345678; + uint8_t inttest_lsb = *(uint8_t *)&inttest; + if (inttest_lsb == 0x12) { + return 1; + } + return 0; +} + size_t getfilesize(const char *filename) { size_t size; |