diff options
Diffstat (limited to 'libtommath/bn_mp_prime_rabin_miller_trials.c')
-rw-r--r-- | libtommath/bn_mp_prime_rabin_miller_trials.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/libtommath/bn_mp_prime_rabin_miller_trials.c b/libtommath/bn_mp_prime_rabin_miller_trials.c index 248c2fd..458e815 100644 --- a/libtommath/bn_mp_prime_rabin_miller_trials.c +++ b/libtommath/bn_mp_prime_rabin_miller_trials.c @@ -15,36 +15,35 @@ * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ - static const struct { - int k, t; + int k, t; } sizes[] = { -{ 128, 28 }, -{ 256, 16 }, -{ 384, 10 }, -{ 512, 7 }, -{ 640, 6 }, -{ 768, 5 }, -{ 896, 4 }, -{ 1024, 4 } + { + 128, 28}, { + 256, 16}, { + 384, 10}, { + 512, 7}, { + 640, 6}, { + 768, 5}, { + 896, 4}, { + 1024, 4} }; /* returns # of RM trials required for a given bit size */ int mp_prime_rabin_miller_trials(int size) { - int x; + int x; - for (x = 0; x < (int)(sizeof(sizes)/(sizeof(sizes[0]))); x++) { - if (sizes[x].k == size) { - return sizes[x].t; - } else if (sizes[x].k > size) { - return (x == 0) ? sizes[0].t : sizes[x - 1].t; - } - } - return sizes[x-1].t + 1; + for (x = 0; x < (int)(sizeof(sizes) / (sizeof(sizes[0]))); x++) { + if (sizes[x].k == size) { + return sizes[x].t; + } else if (sizes[x].k > size) { + return (x == 0) ? sizes[0].t : sizes[x - 1].t; + } + } + return sizes[x - 1].t + 1; } - #endif /* $Source: /cvs/libtom/libtommath/bn_mp_prime_rabin_miller_trials.c,v $ */ |