Fix aligned memory read of unanligend memory

This commit is contained in:
2023-02-03 18:10:57 +01:00
parent 6dc4d620ee
commit 8df55d1594
2 changed files with 13 additions and 1 deletions

View File

@@ -0,0 +1,11 @@
#ifndef __JABYENGINE_UNALIGNED_READ_HPP__
#define __JABYENGINE_UNALIGNED_READ_HPP__
#include "../../stdint.h"
namespace JabyEngine {
uint16_t unaligned_lhu(const uint8_t* adr) {
return (static_cast<uint16_t>(adr[0]) | static_cast<uint16_t>(adr[1]) << 8);
}
}
#endif //!__JABYENGINE_UNALIGNED_READ_HPP__