Page 1 of 3

Recip/Divide routines.

PostPosted: Jul 17, 2003 @ 10:28pm
by rcp
I've noticed a few people stating that recip tables are faster than doing a divide. While I understand the obvious here, I would have thought that the cache hit would negate much of the advantage.

What size recip tables are people using? Is there a routine out there that uses a small recip table and then some code to get a high bit answer? We usually are looking for about 14->16 bits for the recip. ie;

long invW= ((1<<30)/w)<<2; //invW is 16:16
verts->x=imul16(verts->x*invW);
etc...

Actually, everthing is done is ASM to take advantage of the 32x32->64 bit multiply (and accumulate) functions of the ARM.... but you get the idea. ;)

Cheers,

rcp

Recip/Divide routines.

PostPosted: Jul 17, 2003 @ 11:20pm
by bluescrn

PostPosted: Jul 18, 2003 @ 8:27am
by cryo

PostPosted: Jul 18, 2003 @ 8:55am
by rcp

PostPosted: Jul 19, 2003 @ 8:56am
by bluescrn

PostPosted: Jul 19, 2003 @ 9:20am
by refractor

PostPosted: Jul 20, 2003 @ 7:17pm
by Guest
a simple use of logarithms in optimization is to make use of this property:

log(a*b) = log(a) + log(b)

That way, you can code a multiplication (or division using log(a) - log(b)) with 3 table lookups. One for log(a), one for log(b) and one to execute the exponential function.

The advantage of such a system is that you can lookup any multiplication between two integers between 0 and n with log tables that have only n entries.

cryo

PostPosted: Jul 20, 2003 @ 11:17pm
by rcp

PostPosted: Jul 21, 2003 @ 1:40am
by Sergey Chaban

PostPosted: Jul 21, 2003 @ 2:31am
by rcp

PostPosted: Jul 21, 2003 @ 1:00pm
by refractor

PostPosted: Jul 21, 2003 @ 2:09pm
by Sergey Chaban

PostPosted: Jul 21, 2003 @ 3:37pm
by refractor

PostPosted: Jul 22, 2003 @ 5:39am
by rcp

PostPosted: Jul 22, 2003 @ 5:40am
by rcp