Merge pull request #6873 from lioncash/bit
Interpreter_FPUtils: Use Common::BitCast where applicable
This commit is contained in:
commit
82d9dea245
|
@ -5,9 +5,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstring>
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
#include "Common/BitUtils.h"
|
||||||
#include "Common/CPUDetect.h"
|
#include "Common/CPUDetect.h"
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/FloatUtils.h"
|
#include "Common/FloatUtils.h"
|
||||||
|
@ -73,28 +73,18 @@ inline double ForceDouble(double d)
|
||||||
|
|
||||||
inline double Force25Bit(double d)
|
inline double Force25Bit(double d)
|
||||||
{
|
{
|
||||||
u64 integral;
|
u64 integral = Common::BitCast<u64>(d);
|
||||||
std::memcpy(&integral, &d, sizeof(u64));
|
|
||||||
|
|
||||||
integral = (integral & 0xFFFFFFFFF8000000ULL) + (integral & 0x8000000);
|
integral = (integral & 0xFFFFFFFFF8000000ULL) + (integral & 0x8000000);
|
||||||
|
|
||||||
double result;
|
return Common::BitCast<double>(integral);
|
||||||
std::memcpy(&result, &integral, sizeof(double));
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline double MakeQuiet(double d)
|
inline double MakeQuiet(double d)
|
||||||
{
|
{
|
||||||
u64 integral;
|
const u64 integral = Common::BitCast<u64>(d) | Common::DOUBLE_QBIT;
|
||||||
std::memcpy(&integral, &d, sizeof(u64));
|
|
||||||
|
|
||||||
integral |= Common::DOUBLE_QBIT;
|
return Common::BitCast<double>(integral);
|
||||||
|
|
||||||
double result;
|
|
||||||
std::memcpy(&result, &integral, sizeof(double));
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// these functions allow globally modify operations behaviour
|
// these functions allow globally modify operations behaviour
|
||||||
|
|
Loading…
Reference in New Issue