remove trailing whitespace

This commit is contained in:
Love Hornquist Astrand
2011-05-21 11:57:31 -07:00
parent 25e86d6f4d
commit 0879b9831a
539 changed files with 6825 additions and 6825 deletions

View File

@@ -12,16 +12,16 @@ int main(void)
FILE *out;
clock_t t1;
mp_digit z;
mp_init_multi(&q, &p, NULL);
out = fopen("2kprime.1", "w");
for (x = 0; x < (int)(sizeof(sizes) / sizeof(sizes[0])); x++) {
top:
mp_2expt(&q, sizes[x]);
mp_add_d(&q, 3, &q);
z = -3;
t1 = clock();
for(;;) {
mp_sub_d(&q, 4, &q);
@@ -31,13 +31,13 @@ int main(void)
printf("No primes of size %d found\n", sizes[x]);
break;
}
if (clock() - t1 > CLOCKS_PER_SEC) {
if (clock() - t1 > CLOCKS_PER_SEC) {
printf("."); fflush(stdout);
// sleep((clock() - t1 + CLOCKS_PER_SEC/2)/CLOCKS_PER_SEC);
t1 = clock();
}
/* quick test on q */
mp_prime_is_prime(&q, 1, &y);
if (y == 0) {
@@ -60,24 +60,24 @@ int main(void)
break;
}
if (y == 0) {
++sizes[x];
goto top;
}
mp_toradix(&q, buf, 10);
printf("\n\n%d-bits (k = %lu) = %s\n", sizes[x], z, buf);
fprintf(out, "%d-bits (k = %lu) = %s\n", sizes[x], z, buf); fflush(out);
}
return 0;
}
}
/* $Source: /cvs/libtom/libtommath/etc/2kprime.c,v $ */
/* $Revision: 1.2 $ */

View File

@@ -8,10 +8,10 @@ int main(void)
char buf[4096];
FILE *out;
mp_int a, b;
mp_init(&a);
mp_init(&b);
out = fopen("drprimes.txt", "w");
for (x = 0; x < (int)(sizeof(sizes)/sizeof(sizes[0])); x++) {
top:
@@ -21,14 +21,14 @@ int main(void)
for (y = 1; y < sizes[x]; y++) {
a.dp[y] = MP_MASK;
}
/* make a DR modulus */
a.dp[0] = -1;
a.used = sizes[x];
/* now loop */
res = 0;
for (;;) {
for (;;) {
a.dp[0] += 4;
if (a.dp[0] >= MP_MASK) break;
mp_prime_is_prime(&a, 1, &res);
@@ -36,25 +36,25 @@ int main(void)
printf("."); fflush(stdout);
mp_sub_d(&a, 1, &b);
mp_div_2(&b, &b);
mp_prime_is_prime(&b, 3, &res);
mp_prime_is_prime(&b, 3, &res);
if (res == 0) continue;
mp_prime_is_prime(&a, 3, &res);
if (res == 1) break;
}
if (res != 1) {
printf("Error not DR modulus\n"); sizes[x] += 1; goto top;
} else {
mp_toradix(&a, buf, 10);
printf("\n\np == %s\n\n", buf);
fprintf(out, "%d-bit prime:\np == %s\n\n", mp_count_bits(&a), buf); fflush(out);
}
}
}
fclose(out);
mp_clear(&a);
mp_clear(&b);
return 0;
}

View File

@@ -1,4 +1,4 @@
/* Finds Mersenne primes using the Lucas-Lehmer test
/* Finds Mersenne primes using the Lucas-Lehmer test
*
* Tom St Denis, tomstdenis@gmail.com
*/
@@ -10,7 +10,7 @@ is_mersenne (long s, int *pp)
{
mp_int n, u;
int res, k;
*pp = 0;
if ((res = mp_init (&n)) != MP_OKAY) {

View File

@@ -13,21 +13,21 @@ int main(void)
/* loop through various sizes */
for (x = 4; x < 256; x++) {
printf("DIGITS == %3ld...", x); fflush(stdout);
/* make up the odd modulus */
mp_rand(&modulus, x);
modulus.dp[0] |= 1;
/* now find the R value */
mp_montgomery_calc_normalization(&R, &modulus);
mp_montgomery_setup(&modulus, &mp);
/* now run through a bunch tests */
for (y = 0; y < 1000; y++) {
mp_rand(&p, x/2); /* p = random */
mp_mul(&p, &R, &pp); /* pp = R * p */
mp_montgomery_reduce(&pp, &modulus, mp);
/* should be equal to p */
if (mp_cmp(&pp, &p) != MP_EQ) {
printf("FAILURE!\n");
@@ -36,7 +36,7 @@ int main(void)
}
printf("PASSED\n");
}
return 0;
}

View File

@@ -6,7 +6,7 @@
#include <time.h>
/* how many times todo each size mult. Depends on your computer. For slow computers
* this can be low like 5 or 10. For fast [re: Athlon] should be 25 - 50 or so
* this can be low like 5 or 10. For fast [re: Athlon] should be 25 - 50 or so
*/
#define TIMES (1UL<<14UL)
@@ -67,7 +67,7 @@ ulong64 time_mult(int size, int s)
mp_rand (&a, size);
mp_rand (&b, size);
if (s == 1) {
if (s == 1) {
KARATSUBA_MUL_CUTOFF = size;
} else {
KARATSUBA_MUL_CUTOFF = 100000;
@@ -95,7 +95,7 @@ ulong64 time_sqr(int size, int s)
mp_rand (&a, size);
if (s == 1) {
if (s == 1) {
KARATSUBA_SQR_CUTOFF = size;
} else {
KARATSUBA_SQR_CUTOFF = 100000;
@@ -117,7 +117,7 @@ main (void)
ulong64 t1, t2;
int x, y;
for (x = 8; ; x += 2) {
for (x = 8; ; x += 2) {
t1 = time_mult(x, 0);
t2 = time_mult(x, 1);
printf("%d: %9llu %9llu, %9llu\n", x, t1, t2, t2 - t1);
@@ -125,7 +125,7 @@ main (void)
}
y = x;
for (x = 8; ; x += 2) {
for (x = 8; ; x += 2) {
t1 = time_sqr(x, 0);
t2 = time_sqr(x, 1);
printf("%d: %9llu %9llu, %9llu\n", x, t1, t2, t2 - t1);