BAN: Remove endianness functions from Math
There is now a Endianness.h for these. The functions were super slow.
This commit is contained in:
parent
6304388100
commit
0b93fce923
|
@ -102,22 +102,4 @@ namespace BAN::Math
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<integral T>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<integral T>
|
|
||||||
inline constexpr T big_endian_to_host(const uint8_t* bytes)
|
|
||||||
{
|
|
||||||
T result = 0;
|
|
||||||
for (size_t i = 0; i < sizeof(T); i++)
|
|
||||||
result |= (T)bytes[i] << (8 * (sizeof(T) - i - 1));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue