summaryrefslogtreecommitdiffstats
path: root/libtommath/etc
diff options
context:
space:
mode:
Diffstat (limited to 'libtommath/etc')
-rw-r--r--libtommath/etc/2kprime.c4
-rw-r--r--libtommath/etc/drprime.c4
-rw-r--r--libtommath/etc/mersenne.c4
-rw-r--r--libtommath/etc/mont.c4
-rw-r--r--libtommath/etc/pprime.c4
-rw-r--r--libtommath/etc/tune.c27
6 files changed, 25 insertions, 22 deletions
diff --git a/libtommath/etc/2kprime.c b/libtommath/etc/2kprime.c
index fff4825..9450283 100644
--- a/libtommath/etc/2kprime.c
+++ b/libtommath/etc/2kprime.c
@@ -80,5 +80,5 @@ int main(void)
/* $Source$ */
-/* $Revision: 0.36 $ */
-/* $Date: 2005-08-01 16:37:28 +0000 $ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtommath/etc/drprime.c b/libtommath/etc/drprime.c
index ea40bd3..c7d253f 100644
--- a/libtommath/etc/drprime.c
+++ b/libtommath/etc/drprime.c
@@ -60,5 +60,5 @@ int main(void)
/* $Source$ */
-/* $Revision: 0.36 $ */
-/* $Date: 2005-08-01 16:37:28 +0000 $ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtommath/etc/mersenne.c b/libtommath/etc/mersenne.c
index 6f9eed2..ae6725a 100644
--- a/libtommath/etc/mersenne.c
+++ b/libtommath/etc/mersenne.c
@@ -140,5 +140,5 @@ main (void)
}
/* $Source$ */
-/* $Revision: 0.39 $ */
-/* $Date: 2006-04-06 19:49:59 +0000 $ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtommath/etc/mont.c b/libtommath/etc/mont.c
index 8356903..45cf3fd 100644
--- a/libtommath/etc/mont.c
+++ b/libtommath/etc/mont.c
@@ -46,5 +46,5 @@ int main(void)
/* $Source$ */
-/* $Revision: 0.36 $ */
-/* $Date: 2005-08-01 16:37:28 +0000 $ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtommath/etc/pprime.c b/libtommath/etc/pprime.c
index d2d3a32..9f94423 100644
--- a/libtommath/etc/pprime.c
+++ b/libtommath/etc/pprime.c
@@ -396,5 +396,5 @@ main (void)
}
/* $Source$ */
-/* $Revision: 0.39 $ */
-/* $Date: 2006-04-06 19:49:59 +0000 $ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtommath/etc/tune.c b/libtommath/etc/tune.c
index 0094f19..c2ac998 100644
--- a/libtommath/etc/tune.c
+++ b/libtommath/etc/tune.c
@@ -6,18 +6,23 @@
#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)
+#ifndef X86_TIMER
+
/* RDTSC from Scott Duplichan */
static ulong64 TIMFUNC (void)
{
#if defined __GNUC__
#if defined(__i386__) || defined(__x86_64__)
- unsigned long long a;
- __asm__ __volatile__ ("rdtsc\nmovl %%eax,%0\nmovl %%edx,4+%0\n"::"m"(a):"%eax","%edx");
- return a;
+ /* version from http://www.mcs.anl.gov/~kazutomo/rdtsc.html
+ * the old code always got a warning issued by gcc, clang did not complain...
+ */
+ unsigned hi, lo;
+ __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
+ return ((ulong64)lo)|( ((ulong64)hi)<<32);
#else /* gcc-IA64 version */
unsigned long result;
__asm__ __volatile__("mov %0=ar.itc" : "=r"(result) :: "memory");
@@ -42,8 +47,6 @@ static ulong64 TIMFUNC (void)
}
-#ifndef X86_TIMER
-
/* generic ISO C timer */
ulong64 LBL_T;
void t_start(void) { LBL_T = TIMFUNC(); }
@@ -67,7 +70,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 +98,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 +120,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 +128,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);
@@ -138,5 +141,5 @@ main (void)
}
/* $Source$ */
-/* $Revision: 0.39 $ */
-/* $Date: 2006-04-06 19:49:59 +0000 $ */
+/* $Revision$ */
+/* $Date$ */