From f551dbc8acc4b9c5b82fc4891523656996118da1 Mon Sep 17 00:00:00 2001 From: Tom St Denis Date: Wed, 3 Feb 2016 13:07:27 -0500 Subject: [PATCH] Remove all traces of ulong64 as per comment by Karel M --- demo/timing.c | 9 +++++---- etc/tune.c | 23 ++++++++++++----------- tommath.h | 10 ---------- 3 files changed, 17 insertions(+), 25 deletions(-) diff --git a/demo/timing.c b/demo/timing.c index 1bd8489..87224da 100644 --- a/demo/timing.c +++ b/demo/timing.c @@ -1,8 +1,9 @@ #include #include #include +#include -ulong64 _tt; +uint64_t _tt; #ifdef IOWNANATHLON #include @@ -47,7 +48,7 @@ int lbit(void) } /* RDTSC from Scott Duplichan */ -static ulong64 TIMFUNC(void) +static uint64_t TIMFUNC(void) { #if defined __GNUC__ #if defined(__i386__) || defined(__x86_64__) @@ -56,7 +57,7 @@ static ulong64 TIMFUNC(void) */ unsigned hi, lo; __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi)); - return ((ulong64)lo)|( ((ulong64)hi)<<32); + return ((uint64_t)lo)|( ((uint64_t)hi)<<32); #else /* gcc-IA64 version */ unsigned long result; __asm__ __volatile__("mov %0=ar.itc":"=r"(result)::"memory"); @@ -101,7 +102,7 @@ static ulong64 TIMFUNC(void) int main(void) { - ulong64 tt, gg, CLK_PER_SEC; + uint64_t tt, gg, CLK_PER_SEC; FILE *log, *logb, *logc, *logd; mp_int a, b, c, d, e, f; int n, cnt, ix, old_kara_m, old_kara_s, old_toom_m, old_toom_s; diff --git a/etc/tune.c b/etc/tune.c index c2ac998..0208b60 100644 --- a/etc/tune.c +++ b/etc/tune.c @@ -1,9 +1,10 @@ /* Tune the Karatsuba parameters * - * Tom St Denis, tomstdenis@gmail.com + * Tom St Denis, tstdenis82@gmail.com */ #include #include +#include /* 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 @@ -13,7 +14,7 @@ #ifndef X86_TIMER /* RDTSC from Scott Duplichan */ -static ulong64 TIMFUNC (void) +static uint64_t TIMFUNC (void) { #if defined __GNUC__ #if defined(__i386__) || defined(__x86_64__) @@ -22,7 +23,7 @@ static ulong64 TIMFUNC (void) */ unsigned hi, lo; __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi)); - return ((ulong64)lo)|( ((ulong64)hi)<<32); + return ((uint64_t)lo)|( ((uint64_t)hi)<<32); #else /* gcc-IA64 version */ unsigned long result; __asm__ __volatile__("mov %0=ar.itc" : "=r"(result) :: "memory"); @@ -48,20 +49,20 @@ static ulong64 TIMFUNC (void) /* generic ISO C timer */ -ulong64 LBL_T; +uint64_t LBL_T; void t_start(void) { LBL_T = TIMFUNC(); } -ulong64 t_read(void) { return TIMFUNC() - LBL_T; } +uint64_t t_read(void) { return TIMFUNC() - LBL_T; } #else extern void t_start(void); -extern ulong64 t_read(void); +extern uint64_t t_read(void); #endif -ulong64 time_mult(int size, int s) +uint64_t time_mult(int size, int s) { unsigned long x; mp_int a, b, c; - ulong64 t1; + uint64_t t1; mp_init (&a); mp_init (&b); @@ -87,11 +88,11 @@ ulong64 time_mult(int size, int s) return t1; } -ulong64 time_sqr(int size, int s) +uint64_t time_sqr(int size, int s) { unsigned long x; mp_int a, b; - ulong64 t1; + uint64_t t1; mp_init (&a); mp_init (&b); @@ -117,7 +118,7 @@ ulong64 time_sqr(int size, int s) int main (void) { - ulong64 t1, t2; + uint64_t t1, t2; int x, y; for (x = 8; ; x += 2) { diff --git a/tommath.h b/tommath.h index 4c66e15..cec3722 100644 --- a/tommath.h +++ b/tommath.h @@ -57,11 +57,6 @@ extern "C" { #endif #elif defined(MP_64BIT) /* for GCC only on supported platforms */ -#ifndef CRYPT - typedef unsigned long long ulong64; - typedef signed long long long64; -#endif - typedef uint64_t mp_digit; #if defined(_WIN32) typedef unsigned __int128 mp_word; @@ -78,11 +73,6 @@ extern "C" { /* this is the default case, 28-bit digits */ /* this is to make porting into LibTomCrypt easier :-) */ -#ifndef CRYPT - typedef unsigned long long ulong64; - typedef signed long long long64; -#endif - typedef uint32_t mp_digit; typedef uint64_t mp_word;