From 3c5d553456c406936bc1b9105cb3e6b620193c6c Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 4 Jan 2021 23:11:04 +1100 Subject: [PATCH] - Move `krecipasm()` from pragmas.h into polymost.cpp. --- source/build/include/pragmas.h | 11 ----------- source/build/src/engine_priv.h | 1 + source/build/src/polymost.cpp | 9 +++++++++ 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/source/build/include/pragmas.h b/source/build/include/pragmas.h index 59364f1f4..bd07accf1 100644 --- a/source/build/include/pragmas.h +++ b/source/build/include/pragmas.h @@ -10,8 +10,6 @@ #ifndef pragmas_h_ #define pragmas_h_ -extern int32_t reciptable[2048]; - static inline int32_t scale(int32_t eax, int32_t edx, int32_t ecx) { return int64_t(eax) * edx / ecx; @@ -21,13 +19,4 @@ static inline constexpr int ksgn(int32_t a) { return (a > 0) - (a < 0); } inline int sgn(int32_t a) { return (a > 0) - (a < 0); } -static inline int32_t krecipasm(int32_t i) -{ - // Ken did this - union { int32_t i; float f; } x; - x.f = (float)i; - i = x.i; - return ((reciptable[(i >> 12) & 2047] >> (((i - 0x3f800000) >> 23) & 31)) ^ (i >> 31)); -} - #endif // pragmas_h_ diff --git a/source/build/src/engine_priv.h b/source/build/src/engine_priv.h index d8b10438b..77f8eebb1 100644 --- a/source/build/src/engine_priv.h +++ b/source/build/src/engine_priv.h @@ -116,6 +116,7 @@ extern int32_t rx1[MAXWALLSB], ry1[MAXWALLSB]; extern int16_t bunchp2[MAXWALLSB]; extern int16_t numscans, numbunches; extern int32_t rxi[8], ryi[8]; +extern int32_t reciptable[2048]; // int32_t wallmost(int16_t *mostbuf, int32_t w, int32_t sectnum, char dastat); diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 49828add7..f0066088e 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -919,6 +919,15 @@ skip: ; #endif } +// Moved in from pragmas.h +static inline int32_t krecipasm(int32_t i) +{ + // Ken did this + union { int32_t i; float f; } x; + x.f = (float)i; + i = x.i; + return ((reciptable[(i >> 12) & 2047] >> (((i - 0x3f800000) >> 23) & 31)) ^ (i >> 31)); +} // variables that are set to ceiling- or floor-members, depending // on which one is processed right now