We can safely assume that the integer and float byte orders are the same on IEEE754 compliant systems.
} tmp;
::memcpy(&tmp, v.data() + offset, sizeof(TInt));
- if(ENDIAN != Utils::floatByteOrder())
+ if(ENDIAN != Utils::systemByteOrder())
tmp.i = Utils::byteSwap(tmp.i);
return tmp.f;
} tmp;
tmp.f = value;
- if(ENDIAN != Utils::floatByteOrder())
+ if(ENDIAN != Utils::systemByteOrder())
tmp.i = Utils::byteSwap(tmp.i);
return ByteVector(reinterpret_cast<char *>(&tmp), sizeof(TInt));
};
/*!
- * Returns the integer byte order of the system.
+ * Returns the byte order of the system.
*/
inline ByteOrder systemByteOrder()
{
else
return BigEndian;
}
-
- /*!
- * Returns the IEEE754 byte order of the system.
- */
- inline ByteOrder floatByteOrder()
- {
- union {
- double d;
- char c;
- } u;
-
- // 1.0 is stored in memory like 0x3FF0000000000000 in canonical form.
- // So the first byte is zero if little endian.
-
- u.d = 1.0;
- if(u.c == 0)
- return LittleEndian;
- else
- return BigEndian;
- }
}
}
}