diff options
| author | TazyFoundSoup <gardendistrict0x0@outlook.com> | 2026-02-16 12:57:18 +1100 |
|---|---|---|
| committer | TazyFoundSoup <gardendistrict0x0@outlook.com> | 2026-02-16 12:57:18 +1100 |
| commit | 7fea9918dc63eeeac069b01035d68cdceff684d7 (patch) | |
| tree | 379282b00255f37f462862586e9fb7136d3efef9 /src/common.c | |
| parent | 93520564a4aae6a25420f083eb1c7d73372a4ca0 (diff) | |
feat(com): Add little endian
Diffstat (limited to 'src/common.c')
| -rw-r--r-- | src/common.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/common.c b/src/common.c index 9dea3e4..8f14935 100644 --- a/src/common.c +++ b/src/common.c @@ -1,8 +1,17 @@ #include "tinyff/common.h" +#include "common.h" -static inline uint32_t get_big_endian(const uint8_t *buffer) { +inline uint32_t get_big_endian(const uint8_t *buffer) { return (uint32_t)(buffer[0] << 24) | (uint32_t)(buffer[1] << 16) | (uint32_t)(buffer[2] << 8) | (uint32_t)(buffer[3]); +} + +inline uint32_t get_little_endian(const uint8_t *buffer) +{ + return (uint32_t)(buffer[0]) | + (uint32_t)(buffer[1] << 8) | + (uint32_t)(buffer[2] << 16) | + (uint32_t)(buffer[3] << 24); }
\ No newline at end of file |
