FPRecipEstimate: Move offset out of function
MSVC has weird lambda capturing rules.
This commit is contained in:
parent
ddcff86f9c
commit
e76e1186bb
1 changed files with 4 additions and 3 deletions
|
@ -19,17 +19,18 @@
|
||||||
|
|
||||||
namespace Dynarmic::FP {
|
namespace Dynarmic::FP {
|
||||||
|
|
||||||
|
constexpr u64 lut_offset = 256;
|
||||||
|
|
||||||
/// Input is a u0.9 fixed point number. Only values in [0.5, 1.0) are valid.
|
/// Input is a u0.9 fixed point number. Only values in [0.5, 1.0) are valid.
|
||||||
/// Output is a u0.8 fixed point number, with an implied 1 prefixed.
|
/// Output is a u0.8 fixed point number, with an implied 1 prefixed.
|
||||||
/// i.e.: The output is a value in [1.0, 2.0).
|
/// i.e.: The output is a value in [1.0, 2.0).
|
||||||
static u8 RecipEstimate(u64 a) {
|
static u8 RecipEstimate(u64 a) {
|
||||||
constexpr u64 offset = 256;
|
|
||||||
using LUT = std::array<u8, 256>;
|
using LUT = std::array<u8, 256>;
|
||||||
|
|
||||||
static const LUT lut = [] {
|
static const LUT lut = [] {
|
||||||
LUT result{};
|
LUT result{};
|
||||||
for (u64 i = 0; i < result.size(); i++) {
|
for (u64 i = 0; i < result.size(); i++) {
|
||||||
u64 a = i + offset;
|
u64 a = i + lut_offset;
|
||||||
|
|
||||||
a = a * 2 + 1;
|
a = a * 2 + 1;
|
||||||
u64 b = (1u << 19) / a;
|
u64 b = (1u << 19) / a;
|
||||||
|
@ -38,7 +39,7 @@ static u8 RecipEstimate(u64 a) {
|
||||||
return result;
|
return result;
|
||||||
}();
|
}();
|
||||||
|
|
||||||
return lut[a - offset];
|
return lut[a - lut_offset];
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename FPT>
|
template<typename FPT>
|
||||||
|
|
Loading…
Reference in a new issue