const int exponent = ((bytes[0] & 0x7F) << 8) | bytes[1];
// 64-bit fraction. Leading 1 is explicit.
- const ulonglong fraction
- = (static_cast<ulonglong>(bytes[2]) << 56)
- | (static_cast<ulonglong>(bytes[3]) << 48)
- | (static_cast<ulonglong>(bytes[4]) << 40)
- | (static_cast<ulonglong>(bytes[5]) << 32)
- | (static_cast<ulonglong>(bytes[6]) << 24)
- | (static_cast<ulonglong>(bytes[7]) << 16)
- | (static_cast<ulonglong>(bytes[8]) << 8)
- | (static_cast<ulonglong>(bytes[9]));
+ const unsigned long long fraction
+ = (static_cast<unsigned long long>(bytes[2]) << 56)
+ | (static_cast<unsigned long long>(bytes[3]) << 48)
+ | (static_cast<unsigned long long>(bytes[4]) << 40)
+ | (static_cast<unsigned long long>(bytes[5]) << 32)
+ | (static_cast<unsigned long long>(bytes[6]) << 24)
+ | (static_cast<unsigned long long>(bytes[7]) << 16)
+ | (static_cast<unsigned long long>(bytes[8]) << 8)
+ | (static_cast<unsigned long long>(bytes[9]));
long double val;
if(exponent == 0 && fraction == 0)
ByteVector ByteVector::fromFloat64LE(double value)
{
- return fromFloat<double, ulonglong, Utils::LittleEndian>(value);
+ return fromFloat<double, unsigned long long, Utils::LittleEndian>(value);
}
ByteVector ByteVector::fromFloat64BE(double value)
{
- return fromFloat<double, ulonglong, Utils::BigEndian>(value);
+ return fromFloat<double, unsigned long long, Utils::BigEndian>(value);
}
////////////////////////////////////////////////////////////////////////////////
double ByteVector::toFloat64LE(size_t offset) const
{
- return toFloat<double, ulonglong, Utils::LittleEndian>(*this, offset);
+ return toFloat<double, unsigned long long, Utils::LittleEndian>(*this, offset);
}
double ByteVector::toFloat64BE(size_t offset) const
{
- return toFloat<double, ulonglong, Utils::BigEndian>(*this, offset);
+ return toFloat<double, unsigned long long, Utils::BigEndian>(*this, offset);
}
long double ByteVector::toFloat80LE(size_t offset) const