1
0
mirror of synced 2024-11-25 00:00:27 +01:00

Fixed floating point pattern displaying

This commit is contained in:
WerWolv 2021-01-08 11:57:28 +01:00
parent e758b16ba3
commit a41e91a731

View File

@ -335,22 +335,19 @@ namespace hex::lang {
}
void createEntry(prv::Provider* &provider) override {
double formatData = 0;
if (this->getSize() == 4) {
float data = 0;
provider->read(this->getOffset(), &data, 4);
data = hex::changeEndianess(data, 4, this->getEndian());
formatData = data;
this->createDefaultEntry(hex::format("%e (0x%0*lX)", data, this->getSize() * 2, *reinterpret_cast<u32*>(&data)));
} else if (this->getSize() == 8) {
double data = 0;
provider->read(this->getOffset(), &data, 8);
data = hex::changeEndianess(data, 8, this->getEndian());
formatData = data;
this->createDefaultEntry(hex::format("%e (0x%0*lX)", data, this->getSize() * 2, *reinterpret_cast<u64*>(&data)));
}
this->createDefaultEntry(hex::format("%f (0x%0*lx)", formatData, this->getSize() * 2, formatData));
}
[[nodiscard]] std::string getFormattedName() const override {