diff options
author | 2023-10-10 14:33:42 +0000 | |
---|---|---|
committer | 2023-10-10 14:33:42 +0000 | |
commit | af1a266670d040d2f4083ff309d732d648afba2a (patch) | |
tree | 2fc46203448ddcc6f81546d379abfaeb323575e9 /roms/qboot/include/bswap.h | |
parent | e02cda008591317b1625707ff8e115a4841aa889 (diff) |
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'roms/qboot/include/bswap.h')
-rw-r--r-- | roms/qboot/include/bswap.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/roms/qboot/include/bswap.h b/roms/qboot/include/bswap.h new file mode 100644 index 000000000..67b3c4f71 --- /dev/null +++ b/roms/qboot/include/bswap.h @@ -0,0 +1,34 @@ +#ifndef BSWAP_H +#define BSWAP_H 1 + +static inline uint16_t bswap16(uint16_t x) +{ + return __builtin_bswap16(x); +} + +static inline uint32_t bswap32(uint32_t x) +{ + return __builtin_bswap32(x); +} + +static inline uint64_t bswap64(uint64_t x) +{ + return __builtin_bswap64(x); +} + +static inline uint32_t ldl_le_p(const void *p) +{ + uint32_t val; + memcpy(&val, p, 4); + return val; +} + +static inline uint32_t ldl_be_p(const void *p) +{ + uint32_t val; + memcpy(&val, p, 4); + return bswap32(val); +} + + +#endif |