http://d.puremagic.com/issues/show_bug.cgi?id=4125
Marco Leise <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #1 from Marco Leise <[email protected]> 2012-01-31 12:11:35 PST --- Replace uint with ulong for the longer version ;) I use this and it is notably faster than what I used before. uint gcd(uint u, uint v) { int shift; if (u == 0 || v == 0) return u | v; for (shift = 0; ((u | v) & 1) == 0; ++shift) { u >>= 1; v >>= 1; } while ((u & 1) == 0) u >>= 1; do { while ((v & 1) == 0) v >>= 1; if (u < v) { v -= u; } else { uint diff = u - v; u = v; v = diff; } v >>= 1; } while (v != 0); return u << shift; } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
