mirror of
https://github.com/libAthena/athena.git
synced 2025-06-06 14:43:29 +00:00
Ensure stream readers zero-initialize their return values
This commit is contained in:
parent
b40d3b17e5
commit
b9de854400
@ -11,6 +11,7 @@ if(MSVC)
|
|||||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD /O2 /Ob2 /DNDEBUG")
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD /O2 /Ob2 /DNDEBUG")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "-debug -incremental:no")
|
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "-debug -incremental:no")
|
||||||
endif()
|
endif()
|
||||||
|
string(REPLACE "-stdlib=libc++ -fsanitize=memory -fsanitize-memory-track-origins" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||||
|
|
||||||
# Find dependencies
|
# Find dependencies
|
||||||
include(FindLLVM.cmake)
|
include(FindLLVM.cmake)
|
||||||
|
@ -912,28 +912,28 @@ inline void __BinarySizeProp64(const T& obj, size_t& s) {
|
|||||||
|
|
||||||
#define AT_DECL_DNA \
|
#define AT_DECL_DNA \
|
||||||
template <class Op, athena::Endian DNAE = DNAEndian, class T> \
|
template <class Op, athena::Endian DNAE = DNAEndian, class T> \
|
||||||
void Do(const athena::io::PropId& id, T& var, typename Op::StreamT& s) { \
|
void Do(const athena::io::PropId& _id, T& var, typename Op::StreamT& s) { \
|
||||||
athena::io::__Do<Op, T, DNAE>(id, var, s); \
|
athena::io::__Do<Op, T, DNAE>(_id, var, s); \
|
||||||
} \
|
} \
|
||||||
template <class Op, athena::Endian DNAE = DNAEndian, class T> \
|
template <class Op, athena::Endian DNAE = DNAEndian, class T> \
|
||||||
void DoSize(const athena::io::PropId& id, T& var, typename Op::StreamT& s) { \
|
void DoSize(const athena::io::PropId& _id, T& var, typename Op::StreamT& s) { \
|
||||||
athena::io::__DoSize<Op, T, DNAE>(id, var, s); \
|
athena::io::__DoSize<Op, T, DNAE>(_id, var, s); \
|
||||||
} \
|
} \
|
||||||
template <class Op, athena::Endian DNAE = DNAEndian, class T, class S> \
|
template <class Op, athena::Endian DNAE = DNAEndian, class T, class S> \
|
||||||
void Do(const athena::io::PropId& id, std::vector<T>& var, const S& count, typename Op::StreamT& s) { \
|
void Do(const athena::io::PropId& _id, std::vector<T>& var, const S& count, typename Op::StreamT& s) { \
|
||||||
athena::io::__Do<Op, T, S, DNAE>(id, var, count, s); \
|
athena::io::__Do<Op, T, S, DNAE>(_id, var, count, s); \
|
||||||
} \
|
} \
|
||||||
template <class Op> \
|
template <class Op> \
|
||||||
void Do(const athena::io::PropId& id, std::unique_ptr<atUint8[]>& buf, size_t count, typename Op::StreamT& s) { \
|
void Do(const athena::io::PropId& _id, std::unique_ptr<atUint8[]>& buf, size_t count, typename Op::StreamT& s) { \
|
||||||
athena::io::__Do<Op>(id, buf, count, s); \
|
athena::io::__Do<Op>(_id, buf, count, s); \
|
||||||
} \
|
} \
|
||||||
template <class Op> \
|
template <class Op> \
|
||||||
void Do(const athena::io::PropId& id, std::string& str, atInt32 count, typename Op::StreamT& s) { \
|
void Do(const athena::io::PropId& _id, std::string& str, atInt32 count, typename Op::StreamT& s) { \
|
||||||
athena::io::__Do<Op>(id, str, count, s); \
|
athena::io::__Do<Op>(_id, str, count, s); \
|
||||||
} \
|
} \
|
||||||
template <class Op, athena::Endian DNAE = DNAEndian> \
|
template <class Op, athena::Endian DNAE = DNAEndian> \
|
||||||
void Do(const athena::io::PropId& id, std::wstring& str, atInt32 count, typename Op::StreamT& s) { \
|
void Do(const athena::io::PropId& _id, std::wstring& str, atInt32 count, typename Op::StreamT& s) { \
|
||||||
athena::io::__Do<Op, DNAE>(id, str, count, s); \
|
athena::io::__Do<Op, DNAE>(_id, str, count, s); \
|
||||||
} \
|
} \
|
||||||
template <class Op> \
|
template <class Op> \
|
||||||
void DoSeek(atInt64 delta, athena::SeekOrigin whence, typename Op::StreamT& s) { \
|
void DoSeek(atInt64 delta, athena::SeekOrigin whence, typename Op::StreamT& s) { \
|
||||||
@ -983,28 +983,28 @@ inline void __BinarySizeProp64(const T& obj, size_t& s) {
|
|||||||
|
|
||||||
#define AT_DECL_PROPDNA \
|
#define AT_DECL_PROPDNA \
|
||||||
template <class Op, athena::Endian DNAE = DNAEndian, class T> \
|
template <class Op, athena::Endian DNAE = DNAEndian, class T> \
|
||||||
void Do(const athena::io::PropId& id, T& var, typename Op::StreamT& s) { \
|
void Do(const athena::io::PropId& _id, T& var, typename Op::StreamT& s) { \
|
||||||
athena::io::__Do<Op, T, DNAE>(id, var, s); \
|
athena::io::__Do<Op, T, DNAE>(_id, var, s); \
|
||||||
} \
|
} \
|
||||||
template <class Op, athena::Endian DNAE = DNAEndian, class T> \
|
template <class Op, athena::Endian DNAE = DNAEndian, class T> \
|
||||||
void DoSize(const athena::io::PropId& id, T& var, typename Op::StreamT& s) { \
|
void DoSize(const athena::io::PropId& _id, T& var, typename Op::StreamT& s) { \
|
||||||
athena::io::__DoSize<Op, T, DNAE>(id, var, s); \
|
athena::io::__DoSize<Op, T, DNAE>(_id, var, s); \
|
||||||
} \
|
} \
|
||||||
template <class Op, athena::Endian DNAE = DNAEndian, class T, class S> \
|
template <class Op, athena::Endian DNAE = DNAEndian, class T, class S> \
|
||||||
void Do(const athena::io::PropId& id, std::vector<T>& var, const S& count, typename Op::StreamT& s) { \
|
void Do(const athena::io::PropId& _id, std::vector<T>& var, const S& count, typename Op::StreamT& s) { \
|
||||||
athena::io::__Do<Op, T, S, DNAE>(id, var, count, s); \
|
athena::io::__Do<Op, T, S, DNAE>(_id, var, count, s); \
|
||||||
} \
|
} \
|
||||||
template <class Op> \
|
template <class Op> \
|
||||||
void Do(const athena::io::PropId& id, std::unique_ptr<atUint8[]>& buf, size_t count, typename Op::StreamT& s) { \
|
void Do(const athena::io::PropId& _id, std::unique_ptr<atUint8[]>& buf, size_t count, typename Op::StreamT& s) { \
|
||||||
athena::io::__Do<Op>(id, buf, count, s); \
|
athena::io::__Do<Op>(_id, buf, count, s); \
|
||||||
} \
|
} \
|
||||||
template <class Op> \
|
template <class Op> \
|
||||||
void Do(const athena::io::PropId& id, std::string& str, atInt32 count, typename Op::StreamT& s) { \
|
void Do(const athena::io::PropId& _id, std::string& str, atInt32 count, typename Op::StreamT& s) { \
|
||||||
athena::io::__Do<Op>(id, str, count, s); \
|
athena::io::__Do<Op>(_id, str, count, s); \
|
||||||
} \
|
} \
|
||||||
template <class Op, athena::Endian DNAE = DNAEndian> \
|
template <class Op, athena::Endian DNAE = DNAEndian> \
|
||||||
void Do(const athena::io::PropId& id, std::wstring& str, atInt32 count, typename Op::StreamT& s) { \
|
void Do(const athena::io::PropId& _id, std::wstring& str, atInt32 count, typename Op::StreamT& s) { \
|
||||||
athena::io::__Do<Op, DNAE>(id, str, count, s); \
|
athena::io::__Do<Op, DNAE>(_id, str, count, s); \
|
||||||
} \
|
} \
|
||||||
template <class Op> \
|
template <class Op> \
|
||||||
void DoSeek(atInt64 delta, athena::SeekOrigin whence, typename Op::StreamT& s) { \
|
void DoSeek(atInt64 delta, athena::SeekOrigin whence, typename Op::StreamT& s) { \
|
||||||
|
@ -63,7 +63,7 @@ public:
|
|||||||
* @return The value at the current position
|
* @return The value at the current position
|
||||||
*/
|
*/
|
||||||
atInt8 readByte() {
|
atInt8 readByte() {
|
||||||
atInt8 val;
|
atInt8 val = 0;
|
||||||
readUBytesToBuf(&val, 1);
|
readUBytesToBuf(&val, 1);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
@ -104,6 +104,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
std::unique_ptr<atInt8[]> readBytes(atUint64 length) {
|
std::unique_ptr<atInt8[]> readBytes(atUint64 length) {
|
||||||
atInt8* buf = new atInt8[length];
|
atInt8* buf = new atInt8[length];
|
||||||
|
memset(buf, 0, length);
|
||||||
readUBytesToBuf(buf, length);
|
readUBytesToBuf(buf, length);
|
||||||
return std::unique_ptr<atInt8[]>(buf);
|
return std::unique_ptr<atInt8[]>(buf);
|
||||||
}
|
}
|
||||||
@ -114,6 +115,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
std::unique_ptr<atUint8[]> readUBytes(atUint64 length) {
|
std::unique_ptr<atUint8[]> readUBytes(atUint64 length) {
|
||||||
atUint8* buf = new atUint8[length];
|
atUint8* buf = new atUint8[length];
|
||||||
|
memset(buf, 0, length);
|
||||||
readUBytesToBuf(buf, length);
|
readUBytesToBuf(buf, length);
|
||||||
return std::unique_ptr<atUint8[]>(buf);
|
return std::unique_ptr<atUint8[]>(buf);
|
||||||
}
|
}
|
||||||
@ -139,7 +141,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atInt16 readInt16() {
|
atInt16 readInt16() {
|
||||||
atInt16 val;
|
atInt16 val = 0;
|
||||||
readUBytesToBuf(&val, 2);
|
readUBytesToBuf(&val, 2);
|
||||||
return m_endian == Big ? utility::BigInt16(val) : utility::LittleInt16(val);
|
return m_endian == Big ? utility::BigInt16(val) : utility::LittleInt16(val);
|
||||||
}
|
}
|
||||||
@ -154,7 +156,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atInt16 readInt16Little() {
|
atInt16 readInt16Little() {
|
||||||
atInt16 val;
|
atInt16 val = 0;
|
||||||
readUBytesToBuf(&val, 2);
|
readUBytesToBuf(&val, 2);
|
||||||
return utility::LittleInt16(val);
|
return utility::LittleInt16(val);
|
||||||
}
|
}
|
||||||
@ -169,7 +171,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atInt16 readInt16Big() {
|
atInt16 readInt16Big() {
|
||||||
atInt16 val;
|
atInt16 val = 0;
|
||||||
readUBytesToBuf(&val, 2);
|
readUBytesToBuf(&val, 2);
|
||||||
return utility::BigInt16(val);
|
return utility::BigInt16(val);
|
||||||
}
|
}
|
||||||
@ -195,7 +197,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atUint16 readUint16Little() {
|
atUint16 readUint16Little() {
|
||||||
atUint16 val;
|
atUint16 val = 0;
|
||||||
readUBytesToBuf(&val, 2);
|
readUBytesToBuf(&val, 2);
|
||||||
return utility::LittleUint16(val);
|
return utility::LittleUint16(val);
|
||||||
}
|
}
|
||||||
@ -210,7 +212,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atUint16 readUint16Big() {
|
atUint16 readUint16Big() {
|
||||||
atUint16 val;
|
atUint16 val = 0;
|
||||||
readUBytesToBuf(&val, 2);
|
readUBytesToBuf(&val, 2);
|
||||||
return utility::BigUint16(val);
|
return utility::BigUint16(val);
|
||||||
}
|
}
|
||||||
@ -225,7 +227,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atInt32 readInt32() {
|
atInt32 readInt32() {
|
||||||
atInt32 val;
|
atInt32 val = 0;
|
||||||
readUBytesToBuf(&val, 4);
|
readUBytesToBuf(&val, 4);
|
||||||
return m_endian == Big ? utility::BigInt32(val) : utility::LittleInt32(val);
|
return m_endian == Big ? utility::BigInt32(val) : utility::LittleInt32(val);
|
||||||
}
|
}
|
||||||
@ -240,7 +242,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atInt32 readInt32Little() {
|
atInt32 readInt32Little() {
|
||||||
atInt32 val;
|
atInt32 val = 0;
|
||||||
readUBytesToBuf(&val, 4);
|
readUBytesToBuf(&val, 4);
|
||||||
return utility::LittleInt32(val);
|
return utility::LittleInt32(val);
|
||||||
}
|
}
|
||||||
@ -255,7 +257,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atInt32 readInt32Big() {
|
atInt32 readInt32Big() {
|
||||||
atInt32 val;
|
atInt32 val = 0;
|
||||||
readUBytesToBuf(&val, 4);
|
readUBytesToBuf(&val, 4);
|
||||||
return utility::BigInt32(val);
|
return utility::BigInt32(val);
|
||||||
}
|
}
|
||||||
@ -281,7 +283,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atUint32 readUint32Little() {
|
atUint32 readUint32Little() {
|
||||||
atUint32 val;
|
atUint32 val = 0;
|
||||||
readUBytesToBuf(&val, 4);
|
readUBytesToBuf(&val, 4);
|
||||||
return utility::LittleUint32(val);
|
return utility::LittleUint32(val);
|
||||||
}
|
}
|
||||||
@ -296,7 +298,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atUint32 readUint32Big() {
|
atUint32 readUint32Big() {
|
||||||
atUint32 val;
|
atUint32 val = 0;
|
||||||
readUBytesToBuf(&val, 4);
|
readUBytesToBuf(&val, 4);
|
||||||
return utility::BigUint32(val);
|
return utility::BigUint32(val);
|
||||||
}
|
}
|
||||||
@ -311,7 +313,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atInt64 readInt64() {
|
atInt64 readInt64() {
|
||||||
atInt64 val;
|
atInt64 val = 0;
|
||||||
readUBytesToBuf(&val, 8);
|
readUBytesToBuf(&val, 8);
|
||||||
return m_endian == Big ? utility::BigInt64(val) : utility::LittleInt64(val);
|
return m_endian == Big ? utility::BigInt64(val) : utility::LittleInt64(val);
|
||||||
}
|
}
|
||||||
@ -326,7 +328,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atInt64 readInt64Little() {
|
atInt64 readInt64Little() {
|
||||||
atInt64 val;
|
atInt64 val = 0;
|
||||||
readUBytesToBuf(&val, 8);
|
readUBytesToBuf(&val, 8);
|
||||||
return utility::LittleInt64(val);
|
return utility::LittleInt64(val);
|
||||||
}
|
}
|
||||||
@ -341,7 +343,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atInt64 readInt64Big() {
|
atInt64 readInt64Big() {
|
||||||
atInt64 val;
|
atInt64 val = 0;
|
||||||
readUBytesToBuf(&val, 8);
|
readUBytesToBuf(&val, 8);
|
||||||
return utility::BigInt64(val);
|
return utility::BigInt64(val);
|
||||||
}
|
}
|
||||||
@ -367,7 +369,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atUint64 readUint64Little() {
|
atUint64 readUint64Little() {
|
||||||
atUint64 val;
|
atUint64 val = 0;
|
||||||
readUBytesToBuf(&val, 8);
|
readUBytesToBuf(&val, 8);
|
||||||
return utility::LittleUint64(val);
|
return utility::LittleUint64(val);
|
||||||
}
|
}
|
||||||
@ -382,7 +384,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atUint64 readUint64Big() {
|
atUint64 readUint64Big() {
|
||||||
atUint64 val;
|
atUint64 val = 0;
|
||||||
readUBytesToBuf(&val, 8);
|
readUBytesToBuf(&val, 8);
|
||||||
return utility::BigUint64(val);
|
return utility::BigUint64(val);
|
||||||
}
|
}
|
||||||
@ -397,7 +399,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
float readFloat() {
|
float readFloat() {
|
||||||
float val;
|
float val = 0.f;
|
||||||
readUBytesToBuf(&val, 4);
|
readUBytesToBuf(&val, 4);
|
||||||
return m_endian == Big ? utility::BigFloat(val) : utility::LittleFloat(val);
|
return m_endian == Big ? utility::BigFloat(val) : utility::LittleFloat(val);
|
||||||
}
|
}
|
||||||
@ -412,7 +414,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
float readFloatLittle() {
|
float readFloatLittle() {
|
||||||
float val;
|
float val = 0.f;
|
||||||
readUBytesToBuf(&val, 4);
|
readUBytesToBuf(&val, 4);
|
||||||
return utility::LittleFloat(val);
|
return utility::LittleFloat(val);
|
||||||
}
|
}
|
||||||
@ -427,7 +429,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
float readFloatBig() {
|
float readFloatBig() {
|
||||||
float val;
|
float val = 0.f;
|
||||||
readUBytesToBuf(&val, 4);
|
readUBytesToBuf(&val, 4);
|
||||||
return utility::BigFloat(val);
|
return utility::BigFloat(val);
|
||||||
}
|
}
|
||||||
@ -442,7 +444,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
double readDouble() {
|
double readDouble() {
|
||||||
double val;
|
double val = 0.0;
|
||||||
readUBytesToBuf(&val, 8);
|
readUBytesToBuf(&val, 8);
|
||||||
return m_endian == Big ? utility::BigDouble(val) : utility::LittleDouble(val);
|
return m_endian == Big ? utility::BigDouble(val) : utility::LittleDouble(val);
|
||||||
}
|
}
|
||||||
@ -457,7 +459,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
double readDoubleLittle() {
|
double readDoubleLittle() {
|
||||||
double val;
|
double val = 0.0;
|
||||||
readUBytesToBuf(&val, 8);
|
readUBytesToBuf(&val, 8);
|
||||||
return utility::LittleDouble(val);
|
return utility::LittleDouble(val);
|
||||||
}
|
}
|
||||||
@ -472,7 +474,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
double readDoubleBig() {
|
double readDoubleBig() {
|
||||||
double val;
|
double val = 0.0;
|
||||||
readUBytesToBuf(&val, 8);
|
readUBytesToBuf(&val, 8);
|
||||||
return utility::BigDouble(val);
|
return utility::BigDouble(val);
|
||||||
}
|
}
|
||||||
@ -486,7 +488,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
bool readBool() {
|
bool readBool() {
|
||||||
atUint8 val;
|
atUint8 val = false;
|
||||||
readUBytesToBuf(&val, 1);
|
readUBytesToBuf(&val, 1);
|
||||||
return val != 0;
|
return val != 0;
|
||||||
}
|
}
|
||||||
@ -509,7 +511,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atVec2f readVec2f() {
|
atVec2f readVec2f() {
|
||||||
simd_floats val;
|
simd_floats val = {};
|
||||||
readUBytesToBuf(val.data(), 8);
|
readUBytesToBuf(val.data(), 8);
|
||||||
if (m_endian == Big) {
|
if (m_endian == Big) {
|
||||||
val[0] = utility::BigFloat(val[0]);
|
val[0] = utility::BigFloat(val[0]);
|
||||||
@ -535,7 +537,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atVec2f readVec2fLittle() {
|
atVec2f readVec2fLittle() {
|
||||||
simd_floats val;
|
simd_floats val = {};
|
||||||
readUBytesToBuf(val.data(), 8);
|
readUBytesToBuf(val.data(), 8);
|
||||||
val[0] = utility::LittleFloat(val[0]);
|
val[0] = utility::LittleFloat(val[0]);
|
||||||
val[1] = utility::LittleFloat(val[1]);
|
val[1] = utility::LittleFloat(val[1]);
|
||||||
@ -556,7 +558,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atVec2f readVec2fBig() {
|
atVec2f readVec2fBig() {
|
||||||
simd_floats val;
|
simd_floats val = {};
|
||||||
readUBytesToBuf(val.data(), 8);
|
readUBytesToBuf(val.data(), 8);
|
||||||
val[0] = utility::BigFloat(val[0]);
|
val[0] = utility::BigFloat(val[0]);
|
||||||
val[1] = utility::BigFloat(val[1]);
|
val[1] = utility::BigFloat(val[1]);
|
||||||
@ -577,7 +579,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atVec3f readVec3f() {
|
atVec3f readVec3f() {
|
||||||
simd_floats val;
|
simd_floats val = {};
|
||||||
readUBytesToBuf(val.data(), 12);
|
readUBytesToBuf(val.data(), 12);
|
||||||
if (m_endian == Big) {
|
if (m_endian == Big) {
|
||||||
val[0] = utility::BigFloat(val[0]);
|
val[0] = utility::BigFloat(val[0]);
|
||||||
@ -604,7 +606,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atVec3f readVec3fLittle() {
|
atVec3f readVec3fLittle() {
|
||||||
simd_floats val;
|
simd_floats val = {};
|
||||||
readUBytesToBuf(val.data(), 12);
|
readUBytesToBuf(val.data(), 12);
|
||||||
val[0] = utility::LittleFloat(val[0]);
|
val[0] = utility::LittleFloat(val[0]);
|
||||||
val[1] = utility::LittleFloat(val[1]);
|
val[1] = utility::LittleFloat(val[1]);
|
||||||
@ -625,7 +627,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atVec3f readVec3fBig() {
|
atVec3f readVec3fBig() {
|
||||||
simd_floats val;
|
simd_floats val = {};
|
||||||
readUBytesToBuf(val.data(), 12);
|
readUBytesToBuf(val.data(), 12);
|
||||||
val[0] = utility::BigFloat(val[0]);
|
val[0] = utility::BigFloat(val[0]);
|
||||||
val[1] = utility::BigFloat(val[1]);
|
val[1] = utility::BigFloat(val[1]);
|
||||||
@ -646,7 +648,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atVec4f readVec4f() {
|
atVec4f readVec4f() {
|
||||||
simd_floats val;
|
simd_floats val = {};
|
||||||
readUBytesToBuf(val.data(), 16);
|
readUBytesToBuf(val.data(), 16);
|
||||||
if (m_endian == Big) {
|
if (m_endian == Big) {
|
||||||
val[0] = utility::BigFloat(val[0]);
|
val[0] = utility::BigFloat(val[0]);
|
||||||
@ -674,7 +676,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atVec4f readVec4fLittle() {
|
atVec4f readVec4fLittle() {
|
||||||
simd_floats val;
|
simd_floats val = {};
|
||||||
readUBytesToBuf(val.data(), 16);
|
readUBytesToBuf(val.data(), 16);
|
||||||
val[0] = utility::LittleFloat(val[0]);
|
val[0] = utility::LittleFloat(val[0]);
|
||||||
val[1] = utility::LittleFloat(val[1]);
|
val[1] = utility::LittleFloat(val[1]);
|
||||||
@ -695,7 +697,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atVec4f readVec4fBig() {
|
atVec4f readVec4fBig() {
|
||||||
simd_floats val;
|
simd_floats val = {};
|
||||||
readUBytesToBuf(val.data(), 16);
|
readUBytesToBuf(val.data(), 16);
|
||||||
val[0] = utility::BigFloat(val[0]);
|
val[0] = utility::BigFloat(val[0]);
|
||||||
val[1] = utility::BigFloat(val[1]);
|
val[1] = utility::BigFloat(val[1]);
|
||||||
@ -716,7 +718,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atVec2d readVec2d() {
|
atVec2d readVec2d() {
|
||||||
simd_doubles val;
|
simd_doubles val = {};
|
||||||
readUBytesToBuf(val.data(), 16);
|
readUBytesToBuf(val.data(), 16);
|
||||||
if (m_endian == Big) {
|
if (m_endian == Big) {
|
||||||
val[0] = utility::BigDouble(val[0]);
|
val[0] = utility::BigDouble(val[0]);
|
||||||
@ -742,7 +744,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atVec2d readVec2dLittle() {
|
atVec2d readVec2dLittle() {
|
||||||
simd_doubles val;
|
simd_doubles val = {};
|
||||||
readUBytesToBuf(val.data(), 16);
|
readUBytesToBuf(val.data(), 16);
|
||||||
val[0] = utility::LittleDouble(val[0]);
|
val[0] = utility::LittleDouble(val[0]);
|
||||||
val[1] = utility::LittleDouble(val[1]);
|
val[1] = utility::LittleDouble(val[1]);
|
||||||
@ -763,7 +765,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atVec2d readVec2dBig() {
|
atVec2d readVec2dBig() {
|
||||||
simd_doubles val;
|
simd_doubles val = {};
|
||||||
readUBytesToBuf(val.data(), 16);
|
readUBytesToBuf(val.data(), 16);
|
||||||
val[0] = utility::BigDouble(val[0]);
|
val[0] = utility::BigDouble(val[0]);
|
||||||
val[1] = utility::BigDouble(val[1]);
|
val[1] = utility::BigDouble(val[1]);
|
||||||
@ -784,7 +786,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atVec3d readVec3d() {
|
atVec3d readVec3d() {
|
||||||
simd_doubles val;
|
simd_doubles val = {};
|
||||||
readUBytesToBuf(val.data(), 24);
|
readUBytesToBuf(val.data(), 24);
|
||||||
if (m_endian == Big) {
|
if (m_endian == Big) {
|
||||||
val[0] = utility::BigDouble(val[0]);
|
val[0] = utility::BigDouble(val[0]);
|
||||||
@ -811,7 +813,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atVec3d readVec3dLittle() {
|
atVec3d readVec3dLittle() {
|
||||||
simd_doubles val;
|
simd_doubles val = {};
|
||||||
readUBytesToBuf(val.data(), 24);
|
readUBytesToBuf(val.data(), 24);
|
||||||
val[0] = utility::LittleDouble(val[0]);
|
val[0] = utility::LittleDouble(val[0]);
|
||||||
val[1] = utility::LittleDouble(val[1]);
|
val[1] = utility::LittleDouble(val[1]);
|
||||||
@ -832,7 +834,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atVec3d readVec3dBig() {
|
atVec3d readVec3dBig() {
|
||||||
simd_doubles val;
|
simd_doubles val = {};
|
||||||
readUBytesToBuf(val.data(), 24);
|
readUBytesToBuf(val.data(), 24);
|
||||||
val[0] = utility::BigDouble(val[0]);
|
val[0] = utility::BigDouble(val[0]);
|
||||||
val[1] = utility::BigDouble(val[1]);
|
val[1] = utility::BigDouble(val[1]);
|
||||||
@ -853,7 +855,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atVec4d readVec4d() {
|
atVec4d readVec4d() {
|
||||||
simd_doubles val;
|
simd_doubles val = {};
|
||||||
readUBytesToBuf(val.data(), 32);
|
readUBytesToBuf(val.data(), 32);
|
||||||
if (m_endian == Big) {
|
if (m_endian == Big) {
|
||||||
val[0] = utility::BigDouble(val[0]);
|
val[0] = utility::BigDouble(val[0]);
|
||||||
@ -881,7 +883,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atVec4d readVec4dLittle() {
|
atVec4d readVec4dLittle() {
|
||||||
simd_doubles val;
|
simd_doubles val = {};
|
||||||
readUBytesToBuf(val.data(), 32);
|
readUBytesToBuf(val.data(), 32);
|
||||||
val[0] = utility::LittleDouble(val[0]);
|
val[0] = utility::LittleDouble(val[0]);
|
||||||
val[1] = utility::LittleDouble(val[1]);
|
val[1] = utility::LittleDouble(val[1]);
|
||||||
@ -902,7 +904,7 @@ public:
|
|||||||
* @return The value at the current address
|
* @return The value at the current address
|
||||||
*/
|
*/
|
||||||
atVec4d readVec4dBig() {
|
atVec4d readVec4dBig() {
|
||||||
simd_doubles val;
|
simd_doubles val = {};
|
||||||
readUBytesToBuf(val.data(), 32);
|
readUBytesToBuf(val.data(), 32);
|
||||||
val[0] = utility::BigDouble(val[0]);
|
val[0] = utility::BigDouble(val[0]);
|
||||||
val[1] = utility::BigDouble(val[1]);
|
val[1] = utility::BigDouble(val[1]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user