summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/tinyff/common.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/include/tinyff/common.h b/include/tinyff/common.h
index abed24f..0c04ce9 100644
--- a/include/tinyff/common.h
+++ b/include/tinyff/common.h
@@ -14,7 +14,19 @@ typedef bool ff_flag;
// Functions
-inline uint32_t get_big_endian(const uint8_t *buffer);
-inline uint32_t get_little_endian(const uint8_t *buffer);
+static 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]);
+}
+
+static 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);
+}
#endif \ No newline at end of file