Fix voxels in classic -- my error, confusing divscale() and mulscale() in r4576.

Optimizations are left to the reader :P. I would prefer to look for ways of
giving the compilers hints about loops to unroll instead of having to read
the resulting mess of manual unrolling, though.

git-svn-id: https://svn.eduke32.com/eduke32@4728 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2014-11-06 23:43:52 +00:00
parent e278842ce4
commit f1f90439cf

View file

@ -7947,23 +7947,13 @@ static void dosetaspect(void)
if (xdimen != oxdimen && voxlock[0][0]) if (xdimen != oxdimen && voxlock[0][0])
{ {
EDUKE32_STATIC_ASSERT((uint64_t) MAXXDIM*(DISTRECIPSIZ-1) <= INT32_MAX);
if (distrecip == NULL) if (distrecip == NULL)
distrecip = (uint32_t *)Xaligned_alloc(16, DISTRECIPSIZ * sizeof(uint32_t)); distrecip = (uint32_t *)Xaligned_alloc(16, DISTRECIPSIZ * sizeof(uint32_t));
i = 1; for (i=1; i<DISTRECIPSIZ; i++)
distrecip[i] = (xdimen < 1<<11) ?
for (; i<(int32_t) ARRAY_SIZE(distrecip)-4; i+=4) tabledivide32(xdimen<<20, i) :
{ tabledivide64((uint64_t)xdimen<<20, i);
distrecip[i] = (xdimen * i)>>20;
distrecip[i+1] = (xdimen * (i+1))>>20;
distrecip[i+2] = (xdimen * (i+2))>>20;
distrecip[i+3] = (xdimen * (i+3))>>20;
}
for (; i<(int32_t) ARRAY_SIZE(distrecip); i++)
distrecip[i] = (xdimen * i)>>20;
nytooclose = xdimen*2100; nytooclose = xdimen*2100;
} }