summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/tinyff/common.h4
-rw-r--r--src/common.c11
2 files changed, 13 insertions, 2 deletions
diff --git a/include/tinyff/common.h b/include/tinyff/common.h
index 1fc4efb..abed24f 100644
--- a/include/tinyff/common.h
+++ b/include/tinyff/common.h
@@ -4,6 +4,7 @@
#define TINYFF_COMMON_H
#include <stdint.h>
+#include <stdbool.h>
// Flags
typedef bool ff_flag;
@@ -13,6 +14,7 @@ typedef bool ff_flag;
// Functions
-static inline uint32_t get_big_endian(const uint8_t *buffer);
+inline uint32_t get_big_endian(const uint8_t *buffer);
+inline uint32_t get_little_endian(const uint8_t *buffer);
#endif \ No newline at end of file
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