Skip to content

Commit

Permalink
Remove all traces of ulong64 as per comment by Karel M
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom St Denis committed Feb 3, 2016
1 parent 5cba7dd commit f551dbc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 25 deletions.
9 changes: 5 additions & 4 deletions demo/timing.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#include <tommath.h>
#include <time.h>
#include <unistd.h>
#include <stdint.h>

ulong64 _tt;
uint64_t _tt;

#ifdef IOWNANATHLON
#include <unistd.h>
Expand Down Expand Up @@ -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__)
Expand All @@ -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");
Expand Down Expand Up @@ -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;
Expand Down
23 changes: 12 additions & 11 deletions etc/tune.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/* Tune the Karatsuba parameters
*
* Tom St Denis, tomstdenis@gmail.com
* Tom St Denis, tstdenis82@gmail.com
*/
#include <tommath.h>
#include <time.h>
#include <stdint.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
Expand All @@ -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__)
Expand All @@ -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");
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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) {
Expand Down
10 changes: 0 additions & 10 deletions tommath.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down

0 comments on commit f551dbc

Please sign in to comment.