Fix sign compare issues

This commit is contained in:
2025-10-21 09:57:20 +02:00
parent 6016f1fd8e
commit f1d4884d99
2 changed files with 8 additions and 8 deletions

View File

@@ -21,7 +21,7 @@ void BinUtil::Read(T& v) {
// Read data into buffer
m_file.read(reinterpret_cast<char*>(buf.data()), sizeof(T));
// Loop or in be reverse loop and chift the values
for (int i = 0; i < sizeof(T); i++) {
for (size_t i = 0; i < sizeof(T); i++) {
v |= static_cast<T>(buf[m_big ? sizeof(T) - 1 - i : i]) << (8 * i);
}
}
@@ -38,4 +38,4 @@ void BinUtil::Write(const T& v) {
// Write buffer into file
m_file.write(reinterpret_cast<const char*>(buf.data()), sizeof(T));
}
} // namespace ctrff
} // namespace ctrff