mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 20:12:21 +02:00
Fixed const float encoding in reflection
This commit is contained in:
parent
21352b8a7f
commit
aacabd2e13
1 changed files with 10 additions and 2 deletions
|
@ -5416,9 +5416,17 @@ BfIRValue BfModule::CreateFieldData(BfFieldInstance* fieldInstance, int customAt
|
||||||
if (fieldInstance->mConstIdx != -1)
|
if (fieldInstance->mConstIdx != -1)
|
||||||
{
|
{
|
||||||
auto constant = typeInstance->mConstHolder->GetConstantById(fieldInstance->mConstIdx);
|
auto constant = typeInstance->mConstHolder->GetConstantById(fieldInstance->mConstIdx);
|
||||||
constValue = mBfIRBuilder->CreateConst(BfTypeCode_IntPtr, constant->mUInt64);
|
uint64 val = constant->mUInt64;
|
||||||
|
|
||||||
|
if (constant->mTypeCode == BfTypeCode_Float)
|
||||||
|
{
|
||||||
|
float f = (float)*(double*)&val;
|
||||||
|
val = *(uint32*)&f;
|
||||||
|
}
|
||||||
|
|
||||||
|
constValue = mBfIRBuilder->CreateConst(BfTypeCode_IntPtr, val);
|
||||||
if (is32Bit)
|
if (is32Bit)
|
||||||
constValue2 = mBfIRBuilder->CreateConst(BfTypeCode_IntPtr, constant->mUInt64 >> 32);
|
constValue2 = mBfIRBuilder->CreateConst(BfTypeCode_IntPtr, val >> 32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (fieldInstance->GetFieldDef()->mIsStatic)
|
else if (fieldInstance->GetFieldDef()->mIsStatic)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue