This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Recip/Divide routines.


Recip/Divide routines.

Postby rcp » Jul 17, 2003 @ 10:28pm

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
rcp
 


Recip/Divide routines.

Postby bluescrn » Jul 17, 2003 @ 11:20pm

User avatar
bluescrn
pm Member
 
Posts: 107
Joined: Jul 6, 2003 @ 4:20pm
Location: Manchester, England


Postby cryo » Jul 18, 2003 @ 8:27am

User avatar
cryo
pm Member
 
Posts: 204
Joined: Sep 19, 2001 @ 6:01am
Location: Bonn, Germany


Postby rcp » Jul 18, 2003 @ 8:55am

User avatar
rcp
pm Member
 
Posts: 184
Joined: Jul 18, 2003 @ 2:12am
Location: Duluth, GA. (Southeast US)


Postby bluescrn » Jul 19, 2003 @ 8:56am

User avatar
bluescrn
pm Member
 
Posts: 107
Joined: Jul 6, 2003 @ 4:20pm
Location: Manchester, England


Postby refractor » Jul 19, 2003 @ 9:20am

User avatar
refractor
pm Insider
 
Posts: 2304
Joined: Feb 5, 2002 @ 1:12pm
Location: Luxembourg


Postby Guest » Jul 20, 2003 @ 7:17pm

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
Guest
 


Postby rcp » Jul 20, 2003 @ 11:17pm

User avatar
rcp
pm Member
 
Posts: 184
Joined: Jul 18, 2003 @ 2:12am
Location: Duluth, GA. (Southeast US)


Postby Sergey Chaban » Jul 21, 2003 @ 1:40am

Sergey Chaban
pm Member
 
Posts: 72
Joined: Nov 12, 2002 @ 1:45am


Postby rcp » Jul 21, 2003 @ 2:31am

User avatar
rcp
pm Member
 
Posts: 184
Joined: Jul 18, 2003 @ 2:12am
Location: Duluth, GA. (Southeast US)


Postby refractor » Jul 21, 2003 @ 1:00pm

User avatar
refractor
pm Insider
 
Posts: 2304
Joined: Feb 5, 2002 @ 1:12pm
Location: Luxembourg


Postby Sergey Chaban » Jul 21, 2003 @ 2:09pm

Sergey Chaban
pm Member
 
Posts: 72
Joined: Nov 12, 2002 @ 1:45am


Postby refractor » Jul 21, 2003 @ 3:37pm

User avatar
refractor
pm Insider
 
Posts: 2304
Joined: Feb 5, 2002 @ 1:12pm
Location: Luxembourg


Postby rcp » Jul 22, 2003 @ 5:39am

User avatar
rcp
pm Member
 
Posts: 184
Joined: Jul 18, 2003 @ 2:12am
Location: Duluth, GA. (Southeast US)


Postby rcp » Jul 22, 2003 @ 5:40am

User avatar
rcp
pm Member
 
Posts: 184
Joined: Jul 18, 2003 @ 2:12am
Location: Duluth, GA. (Southeast US)


Next

Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum