Lair Of The Multimedia Guru

2005-11-23

Fast greatest common divisor

How do we find the greatest common divisor of 2 integers? Try all integers which are ≤ then the arguments and select the largest which divides both with no remainder, works but its too slow. Or maybe factorize both, take the common factors and multiply them together like they probably told you in school, but thats still far too slow for anything but the small numbers in school excercies
(more…)

Filed under: Optimization — Michael @ 07:08

2005-11-22

Fast integer square root

How to calculate the square root of an integer? (unsigned int)sqrt(x) sure but that is slow on many CPUs (~127 cpu cycles on a P3) it also needs a FPU, which may or may not be a problem, how can we do this quicker? lets see
(more…)

Filed under: Optimization — Michael @ 17:21
« Previous Page

Powered by WordPress