GCC warnings fix

This commit is contained in:
MihailRis
2023-11-23 19:26:40 +03:00
parent 50aa5fdc70
commit cc556bc19b
2 changed files with 17 additions and 4 deletions
+12 -3
View File
@@ -60,7 +60,12 @@ void BinaryWriter::putInt64(int64_t val) {
}
void BinaryWriter::putFloat32(float val) {
putInt32(*((uint32_t*)&val));
union {
int32_t vali32;
float valfloat;
} value;
value.valfloat = val;
putInt32(value.vali32);
}
BinaryReader::BinaryReader(const ubyte* data, size_t size)
@@ -122,8 +127,12 @@ int64_t BinaryReader::getInt64() {
}
float BinaryReader::getFloat32() {
int32_t value = getInt32();
return *(float*)(&value);
union {
int32_t vali32;
float valfloat;
} value;
value.vali32 = getInt32();
return value.valfloat;
}
string BinaryReader::getString() {