Better fix for the 32-bit float reading.
This commit is contained in:
parent
6a191cce0a
commit
0aac17874c
@ -173,13 +173,14 @@ public:
|
|||||||
{
|
{
|
||||||
ASSERT(m_Tags[a_Tag].m_Type == TAG_Float);
|
ASSERT(m_Tags[a_Tag].m_Type == TAG_Float);
|
||||||
|
|
||||||
// Cause a compile-time error if sizeof(int) != sizeof(float)
|
// Cause a compile-time error if sizeof(float) != 4
|
||||||
char Check1[sizeof(int) - sizeof(float) + 1]; // sizeof(int) >= sizeof(float)
|
// If your platform produces a compiler error here, you'll need to add code that manually decodes 32-bit floats
|
||||||
char Check2[sizeof(float) - sizeof(int) + 1]; // sizeof(float) >= sizeof(int)
|
char Check1[5 - sizeof(float)]; // sizeof(float) <= 4
|
||||||
|
char Check2[sizeof(float) - 3]; // sizeof(float) >= 4
|
||||||
UNUSED(Check1);
|
UNUSED(Check1);
|
||||||
UNUSED(Check2);
|
UNUSED(Check2);
|
||||||
|
|
||||||
int i = GetBEInt(m_Data + m_Tags[a_Tag].m_DataStart);
|
Int32 i = GetBEInt(m_Data + m_Tags[a_Tag].m_DataStart);
|
||||||
float f;
|
float f;
|
||||||
memcpy(&f, &i, sizeof(f));
|
memcpy(&f, &i, sizeof(f));
|
||||||
return f;
|
return f;
|
||||||
|
Loading…
Reference in New Issue
Block a user