From e76e1186bb3b1d986b336b209f2c03a3f98946c8 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Wed, 25 Jul 2018 19:22:16 +0100 Subject: [PATCH] FPRecipEstimate: Move offset out of function MSVC has weird lambda capturing rules. --- src/common/fp/op/FPRecipEstimate.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/common/fp/op/FPRecipEstimate.cpp b/src/common/fp/op/FPRecipEstimate.cpp index 991dd61e..c809a9c6 100644 --- a/src/common/fp/op/FPRecipEstimate.cpp +++ b/src/common/fp/op/FPRecipEstimate.cpp @@ -19,17 +19,18 @@ 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. /// 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). static u8 RecipEstimate(u64 a) { - constexpr u64 offset = 256; using LUT = std::array; static const LUT lut = [] { LUT result{}; for (u64 i = 0; i < result.size(); i++) { - u64 a = i + offset; + u64 a = i + lut_offset; a = a * 2 + 1; u64 b = (1u << 19) / a; @@ -38,7 +39,7 @@ static u8 RecipEstimate(u64 a) { return result; }(); - return lut[a - offset]; + return lut[a - lut_offset]; } template