Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void simplify (int& a, int& b) {
- while (1) {
- bool repeat = false;
- for (ulong x = 0; x < NUM_PRIMES; x++) {
- ulong i = NUM_PRIMES - x - 1;
- ushort prime = g_PrimeNumbers[i];
- if (a <= prime || b <= prime)
- continue;
- if (a % prime == 0 && b % prime == 0) {
- a /= prime;
- b /= prime;
- repeat = true;
- break;
- }
- }
- if (!repeat)
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment