- Move `krecipasm()` from pragmas.h into polymost.cpp.

This commit is contained in:
Mitchell Richters 2021-01-04 23:11:04 +11:00
parent d460f048fa
commit 3c5d553456
3 changed files with 10 additions and 11 deletions

View File

@ -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_

View File

@ -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);

View File

@ -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