- removed krecipasm.

Analyzing the results, this is not needed as its precision is virtually the same as floating point math, so its one use got replaced.
This commit is contained in:
Christoph Oelckers 2021-03-19 14:23:41 +01:00
parent dd15fc54c1
commit 76682c72e3
3 changed files with 3 additions and 18 deletions

View file

@ -73,7 +73,6 @@ int32_t globalflags;
static int8_t tempbuf[MAXWALLS]; static int8_t tempbuf[MAXWALLS];
// referenced from asm // referenced from asm
int32_t reciptable[2048];
intptr_t asm1, asm2; intptr_t asm1, asm2;
int32_t globalx1, globaly2, globalx3, globaly3; int32_t globalx1, globaly2, globalx3, globaly3;
@ -319,9 +318,6 @@ static int32_t engineLoadTables(void)
{ {
int32_t i; int32_t i;
for (i=0; i<2048; i++)
reciptable[i] = DivScale(2048, i+2048, 30);
for (i=0; i<=512; i++) for (i=0; i<=512; i++)
sintable[i] = bsinf(i); sintable[i] = bsinf(i);
for (i=513; i<1024; i++) for (i=513; i<1024; i++)

View file

@ -69,7 +69,6 @@ extern int32_t rx1[MAXWALLSB], ry1[MAXWALLSB];
extern int16_t bunchp2[MAXWALLSB]; extern int16_t bunchp2[MAXWALLSB];
extern int16_t numscans, numbunches; extern int16_t numscans, numbunches;
extern int32_t rxi[8], ryi[8]; 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); // int32_t wallmost(int16_t *mostbuf, int32_t w, int32_t sectnum, char dastat);

View file

@ -915,16 +915,6 @@ skip: ;
#endif #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 // variables that are set to ceiling- or floor-members, depending
// on which one is processed right now // on which one is processed right now
static int32_t global_cf_z; static int32_t global_cf_z;
@ -956,14 +946,14 @@ static void polymost_internal_nonparallaxed(vec2f_t n0, vec2f_t n1, float ryp0,
wall[wall[sec->wallptr].point2].y - wall[sec->wallptr].y }; wall[wall[sec->wallptr].point2].y - wall[sec->wallptr].y };
float r; float r;
int length = ksqrt(uhypsq(xy.x, xy.y));
if (globalorientation & 2) if (globalorientation & 2)
{ {
int i = krecipasm(ksqrt(uhypsq(xy.x,xy.y))); r = 1.f / length;
r = i * (1.f/1073741824.f);
} }
else else
{ {
int i = ksqrt(uhypsq(xy.x,xy.y)); if (i == 0) i = 1024; else i = 1048576 / i; int i; if (length == 0) i = 1024; else i = 1048576 / length; // consider integer truncation
r = i * (1.f/1048576.f); r = i * (1.f/1048576.f);
} }