engine: add klabs() back into ksqrtasm_old()

This commit is contained in:
Richard C. Gobeille 2020-06-12 17:07:27 -07:00 committed by Christoph Oelckers
parent ba4eb3f906
commit d28929c437

View file

@ -67,12 +67,15 @@ extern uint16_t sqrtable[4096], shlookup[4096+256],sqrtable_old[2048];
inline int32_t ksqrtasm_old(int32_t n) inline int32_t ksqrtasm_old(int32_t n)
{ {
n = klabs(n); uint32_t shift = 0;
int shift; n = klabs((int32_t)n);
for (shift = 0; n >= 2048; n >>=2, shift++) while (n >= 2048)
{ {
n >>= 2;
++shift;
} }
return (sqrtable_old[n]<<shift)>>10; uint32_t const s = sqrtable_old[n];
return (s << shift) >> 10;
} }
inline int32_t clip_nsqrtasm(int32_t n) inline int32_t clip_nsqrtasm(int32_t n)