forked from ibphoenix/tomsfastmath
trim trailing spaces
This commit is contained in:
parent
f5b5bc09fb
commit
f8227a0dd9
@ -1,10 +1,10 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library.
|
||||||
*
|
*
|
||||||
* This project is meant to fill in where LibTomMath
|
* This project is meant to fill in where LibTomMath
|
||||||
* falls short. That is speed ;-)
|
* falls short. That is speed ;-)
|
||||||
*
|
*
|
||||||
* This project is public domain and free for all purposes.
|
* This project is public domain and free for all purposes.
|
||||||
*
|
*
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
* Tom St Denis, tomstdenis@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ printf(
|
|||||||
for (y = 0; y < N; y++) {
|
for (y = 0; y < N; y++) {
|
||||||
for (z = 0; z < N; z++) {
|
for (z = 0; z < N; z++) {
|
||||||
if (y<=z && (y+z)==x) {
|
if (y<=z && (y+z)==x) {
|
||||||
if (y == z) {
|
if (y == z) {
|
||||||
printf("SQRADD(a[%d], a[%d]); ", y, y);
|
printf("SQRADD(a[%d], a[%d]); ", y, y);
|
||||||
} else {
|
} else {
|
||||||
printf("SQRADD2(a[%d], a[%d]); ", y, z);
|
printf("SQRADD2(a[%d], a[%d]); ", y, z);
|
||||||
@ -63,17 +63,17 @@ printf(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// new method
|
// new method
|
||||||
/* do evens first */
|
/* do evens first */
|
||||||
f = 0;
|
f = 0;
|
||||||
for (y = 0; y < N; y++) {
|
for (y = 0; y < N; y++) {
|
||||||
for (z = 0; z < N; z++) {
|
for (z = 0; z < N; z++) {
|
||||||
if (z != y && z + y == x && y <= z) {
|
if (z != y && z + y == x && y <= z) {
|
||||||
if (f == 0) {
|
if (f == 0) {
|
||||||
// first double
|
// first double
|
||||||
printf("SQRADDSC(a[%d], a[%d]); ", y, z);
|
printf("SQRADDSC(a[%d], a[%d]); ", y, z);
|
||||||
f = 1;
|
f = 1;
|
||||||
} else {
|
} else {
|
||||||
printf("SQRADDAC(a[%d], a[%d]); ", y, z);
|
printf("SQRADDAC(a[%d], a[%d]); ", y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -82,7 +82,7 @@ printf(
|
|||||||
// forward the carry
|
// forward the carry
|
||||||
printf("SQRADDDB; ");
|
printf("SQRADDDB; ");
|
||||||
if ((x&1) == 0) {
|
if ((x&1) == 0) {
|
||||||
// add the square
|
// add the square
|
||||||
printf("SQRADD(a[%d], a[%d]); ", x/2, x/2);
|
printf("SQRADD(a[%d], a[%d]); ", x/2, x/2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library.
|
||||||
*
|
*
|
||||||
* This project is meant to fill in where LibTomMath
|
* This project is meant to fill in where LibTomMath
|
||||||
* falls short. That is speed ;-)
|
* falls short. That is speed ;-)
|
||||||
*
|
*
|
||||||
* This project is public domain and free for all purposes.
|
* This project is public domain and free for all purposes.
|
||||||
*
|
*
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
* Tom St Denis, tomstdenis@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ printf(
|
|||||||
for (y = 0; y < N; y++) {
|
for (y = 0; y < N; y++) {
|
||||||
for (z = 0; z < N; z++) {
|
for (z = 0; z < N; z++) {
|
||||||
if (y<=z && (y+z)==x) {
|
if (y<=z && (y+z)==x) {
|
||||||
if (y == z) {
|
if (y == z) {
|
||||||
printf(" SQRADD(a[%d], a[%d]); ", y, y);
|
printf(" SQRADD(a[%d], a[%d]); ", y, y);
|
||||||
} else {
|
} else {
|
||||||
printf(" SQRADD2(a[%d], a[%d]); ", y, z);
|
printf(" SQRADD2(a[%d], a[%d]); ", y, z);
|
||||||
@ -69,17 +69,17 @@ printf(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// new method
|
// new method
|
||||||
/* do evens first */
|
/* do evens first */
|
||||||
f = 0;
|
f = 0;
|
||||||
for (y = 0; y < N; y++) {
|
for (y = 0; y < N; y++) {
|
||||||
for (z = 0; z < N; z++) {
|
for (z = 0; z < N; z++) {
|
||||||
if (z != y && z + y == x && y <= z) {
|
if (z != y && z + y == x && y <= z) {
|
||||||
if (f == 0) {
|
if (f == 0) {
|
||||||
// first double
|
// first double
|
||||||
printf("SQRADDSC(a[%d], a[%d]); ", y, z);
|
printf("SQRADDSC(a[%d], a[%d]); ", y, z);
|
||||||
f = 1;
|
f = 1;
|
||||||
} else {
|
} else {
|
||||||
printf("SQRADDAC(a[%d], a[%d]); ", y, z);
|
printf("SQRADDAC(a[%d], a[%d]); ", y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ printf(
|
|||||||
// forward the carry
|
// forward the carry
|
||||||
printf("SQRADDDB; ");
|
printf("SQRADDDB; ");
|
||||||
if ((x&1) == 0) {
|
if ((x&1) == 0) {
|
||||||
// add the square
|
// add the square
|
||||||
printf("SQRADD(a[%d], a[%d]); ", x/2, x/2);
|
printf("SQRADD(a[%d], a[%d]); ", x/2, x/2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library.
|
||||||
*
|
*
|
||||||
* This project is meant to fill in where LibTomMath
|
* This project is meant to fill in where LibTomMath
|
||||||
* falls short. That is speed ;-)
|
* falls short. That is speed ;-)
|
||||||
*
|
*
|
||||||
* This project is public domain and free for all purposes.
|
* This project is public domain and free for all purposes.
|
||||||
*
|
*
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
* Tom St Denis, tomstdenis@gmail.com
|
||||||
*/
|
*/
|
||||||
#include <tfm.h>
|
#include <tfm.h>
|
||||||
@ -23,9 +23,9 @@ void fp_mul(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
y = MAX(A->used, B->used);
|
y = MAX(A->used, B->used);
|
||||||
yy = MIN(A->used, B->used);
|
yy = MIN(A->used, B->used);
|
||||||
/* pick a comba (unrolled 4/8/16/32 x or rolled) based on the size
|
/* pick a comba (unrolled 4/8/16/32 x or rolled) based on the size
|
||||||
of the largest input. We also want to avoid doing excess mults if the
|
of the largest input. We also want to avoid doing excess mults if the
|
||||||
inputs are not close to the next power of two. That is, for example,
|
inputs are not close to the next power of two. That is, for example,
|
||||||
if say y=17 then we would do (32-17)^2 = 225 unneeded multiplications
|
if say y=17 then we would do (32-17)^2 = 225 unneeded multiplications
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef TFM_MUL3
|
#ifdef TFM_MUL3
|
||||||
@ -82,7 +82,7 @@ void fp_mul(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
fp_mul_comba_small(A,B,C);
|
fp_mul_comba_small(A,B,C);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(TFM_MUL20)
|
#if defined(TFM_MUL20)
|
||||||
if (y <= 20) {
|
if (y <= 20) {
|
||||||
fp_mul_comba20(A,B,C);
|
fp_mul_comba20(A,B,C);
|
||||||
@ -112,7 +112,7 @@ void fp_mul(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
fp_mul_comba48(A,B,C);
|
fp_mul_comba48(A,B,C);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(TFM_MUL64)
|
#if defined(TFM_MUL64)
|
||||||
if (yy >= 56 && y <= 64) {
|
if (yy >= 56 && y <= 64) {
|
||||||
fp_mul_comba64(A,B,C);
|
fp_mul_comba64(A,B,C);
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library.
|
||||||
*
|
*
|
||||||
* This project is meant to fill in where LibTomMath
|
* This project is meant to fill in where LibTomMath
|
||||||
* falls short. That is speed ;-)
|
* falls short. That is speed ;-)
|
||||||
*
|
*
|
||||||
* This project is public domain and free for all purposes.
|
* This project is public domain and free for all purposes.
|
||||||
*
|
*
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
* Tom St Denis, tomstdenis@gmail.com
|
||||||
*/
|
*/
|
||||||
#include <tfm.h>
|
#include <tfm.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user