1
0
Fork 0

Adding Spectre/System/ByteOrder

This commit is contained in:
Henrik Hautakoski 2020-10-21 11:14:17 +02:00
parent 396f47cc22
commit 58513d70c0
3 changed files with 36 additions and 0 deletions

View file

@ -0,0 +1,20 @@
#include <Spectre/System/ByteOrder.h>
namespace sp { namespace system
{
uint16_t ltoh16(const uint8_t* bytes)
{
return bytes[0] | (bytes[1] << 8);
}
uint32_t ltoh32(const uint8_t* bytes)
{
return bytes[0]
| (bytes[1] << 8)
| (bytes[2] << 16)
| (bytes[3] << 24);
}
} } // namespace sp::system