diff --git a/BAN/include/BAN/Math.h b/BAN/include/BAN/Math.h index 933bfdac4..e0778ebb1 100644 --- a/BAN/include/BAN/Math.h +++ b/BAN/include/BAN/Math.h @@ -2,6 +2,7 @@ #include +#include #include namespace BAN::Math @@ -50,4 +51,13 @@ namespace BAN::Math return (a + b - 1) / b; } + template + inline constexpr T little_endian_to_host(const uint8_t* bytes) + { + T result = 0; + for (size_t i = 0; i < sizeof(T); i++) + result |= (T)bytes[i] << (i * 8); + return result; + } + } \ No newline at end of file