src/misc.cpp

changeset 498
791c831c8020
parent 493
16766ac1bbd9
child 500
cad8cdc42a64
equal deleted inserted replaced
497:c51941e590b6 498:791c831c8020
24 #include "gui.h" 24 #include "gui.h"
25 #include "dialogs.h" 25 #include "dialogs.h"
26 #include "ui_rotpoint.h" 26 #include "ui_rotpoint.h"
27 27
28 // Prime number table. 28 // Prime number table.
29 const ushort g_primes[NUM_PRIMES] = 29 const int g_primes[NUM_PRIMES] =
30 { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 30 { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29,
31 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 31 31, 37, 41, 43, 47, 53, 59, 61, 67, 71,
32 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 32 73, 79, 83, 89, 97, 101, 103, 107, 109, 113,
33 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 33 127, 131, 137, 139, 149, 151, 157, 163, 167, 173,
34 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 34 179, 181, 191, 193, 197, 199, 211, 223, 227, 229,
185 { bool repeat; 185 { bool repeat;
186 186
187 do 187 do
188 { repeat = false; 188 { repeat = false;
189 189
190 for (ushort x = 0; x < NUM_PRIMES; x++) 190 for (int x = 0; x < NUM_PRIMES; x++)
191 { const ushort prime = g_primes[NUM_PRIMES - x - 1]; 191 { const int prime = g_primes[NUM_PRIMES - x - 1];
192 192
193 if (numer <= prime || denom <= prime) 193 if (numer <= prime || denom <= prime)
194 continue; 194 continue;
195 195
196 if ( (numer % prime == 0) && (denom % prime == 0)) 196 if ( (numer % prime == 0) && (denom % prime == 0))

mercurial