Remove all traces of ulong64 as per comment by Karel M
This commit is contained in:
parent
5cba7dd8fe
commit
f551dbc8ac
@ -1,8 +1,9 @@
|
|||||||
#include <tommath.h>
|
#include <tommath.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
ulong64 _tt;
|
uint64_t _tt;
|
||||||
|
|
||||||
#ifdef IOWNANATHLON
|
#ifdef IOWNANATHLON
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -47,7 +48,7 @@ int lbit(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* RDTSC from Scott Duplichan */
|
/* RDTSC from Scott Duplichan */
|
||||||
static ulong64 TIMFUNC(void)
|
static uint64_t TIMFUNC(void)
|
||||||
{
|
{
|
||||||
#if defined __GNUC__
|
#if defined __GNUC__
|
||||||
#if defined(__i386__) || defined(__x86_64__)
|
#if defined(__i386__) || defined(__x86_64__)
|
||||||
@ -56,7 +57,7 @@ static ulong64 TIMFUNC(void)
|
|||||||
*/
|
*/
|
||||||
unsigned hi, lo;
|
unsigned hi, lo;
|
||||||
__asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
|
__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 */
|
#else /* gcc-IA64 version */
|
||||||
unsigned long result;
|
unsigned long result;
|
||||||
__asm__ __volatile__("mov %0=ar.itc":"=r"(result)::"memory");
|
__asm__ __volatile__("mov %0=ar.itc":"=r"(result)::"memory");
|
||||||
@ -101,7 +102,7 @@ static ulong64 TIMFUNC(void)
|
|||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
ulong64 tt, gg, CLK_PER_SEC;
|
uint64_t tt, gg, CLK_PER_SEC;
|
||||||
FILE *log, *logb, *logc, *logd;
|
FILE *log, *logb, *logc, *logd;
|
||||||
mp_int a, b, c, d, e, f;
|
mp_int a, b, c, d, e, f;
|
||||||
int n, cnt, ix, old_kara_m, old_kara_s, old_toom_m, old_toom_s;
|
int n, cnt, ix, old_kara_m, old_kara_s, old_toom_m, old_toom_s;
|
||||||
|
23
etc/tune.c
23
etc/tune.c
@ -1,9 +1,10 @@
|
|||||||
/* Tune the Karatsuba parameters
|
/* Tune the Karatsuba parameters
|
||||||
*
|
*
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
* Tom St Denis, tstdenis82@gmail.com
|
||||||
*/
|
*/
|
||||||
#include <tommath.h>
|
#include <tommath.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
/* how many times todo each size mult. Depends on your computer. For slow computers
|
/* 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
|
||||||
@ -13,7 +14,7 @@
|
|||||||
#ifndef X86_TIMER
|
#ifndef X86_TIMER
|
||||||
|
|
||||||
/* RDTSC from Scott Duplichan */
|
/* RDTSC from Scott Duplichan */
|
||||||
static ulong64 TIMFUNC (void)
|
static uint64_t TIMFUNC (void)
|
||||||
{
|
{
|
||||||
#if defined __GNUC__
|
#if defined __GNUC__
|
||||||
#if defined(__i386__) || defined(__x86_64__)
|
#if defined(__i386__) || defined(__x86_64__)
|
||||||
@ -22,7 +23,7 @@ static ulong64 TIMFUNC (void)
|
|||||||
*/
|
*/
|
||||||
unsigned hi, lo;
|
unsigned hi, lo;
|
||||||
__asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
|
__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 */
|
#else /* gcc-IA64 version */
|
||||||
unsigned long result;
|
unsigned long result;
|
||||||
__asm__ __volatile__("mov %0=ar.itc" : "=r"(result) :: "memory");
|
__asm__ __volatile__("mov %0=ar.itc" : "=r"(result) :: "memory");
|
||||||
@ -48,20 +49,20 @@ static ulong64 TIMFUNC (void)
|
|||||||
|
|
||||||
|
|
||||||
/* generic ISO C timer */
|
/* generic ISO C timer */
|
||||||
ulong64 LBL_T;
|
uint64_t LBL_T;
|
||||||
void t_start(void) { LBL_T = TIMFUNC(); }
|
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
|
#else
|
||||||
extern void t_start(void);
|
extern void t_start(void);
|
||||||
extern ulong64 t_read(void);
|
extern uint64_t t_read(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ulong64 time_mult(int size, int s)
|
uint64_t time_mult(int size, int s)
|
||||||
{
|
{
|
||||||
unsigned long x;
|
unsigned long x;
|
||||||
mp_int a, b, c;
|
mp_int a, b, c;
|
||||||
ulong64 t1;
|
uint64_t t1;
|
||||||
|
|
||||||
mp_init (&a);
|
mp_init (&a);
|
||||||
mp_init (&b);
|
mp_init (&b);
|
||||||
@ -87,11 +88,11 @@ ulong64 time_mult(int size, int s)
|
|||||||
return t1;
|
return t1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ulong64 time_sqr(int size, int s)
|
uint64_t time_sqr(int size, int s)
|
||||||
{
|
{
|
||||||
unsigned long x;
|
unsigned long x;
|
||||||
mp_int a, b;
|
mp_int a, b;
|
||||||
ulong64 t1;
|
uint64_t t1;
|
||||||
|
|
||||||
mp_init (&a);
|
mp_init (&a);
|
||||||
mp_init (&b);
|
mp_init (&b);
|
||||||
@ -117,7 +118,7 @@ ulong64 time_sqr(int size, int s)
|
|||||||
int
|
int
|
||||||
main (void)
|
main (void)
|
||||||
{
|
{
|
||||||
ulong64 t1, t2;
|
uint64_t t1, t2;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
for (x = 8; ; x += 2) {
|
for (x = 8; ; x += 2) {
|
||||||
|
10
tommath.h
10
tommath.h
@ -57,11 +57,6 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
#elif defined(MP_64BIT)
|
#elif defined(MP_64BIT)
|
||||||
/* for GCC only on supported platforms */
|
/* for GCC only on supported platforms */
|
||||||
#ifndef CRYPT
|
|
||||||
typedef unsigned long long ulong64;
|
|
||||||
typedef signed long long long64;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef uint64_t mp_digit;
|
typedef uint64_t mp_digit;
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
typedef unsigned __int128 mp_word;
|
typedef unsigned __int128 mp_word;
|
||||||
@ -78,11 +73,6 @@ extern "C" {
|
|||||||
/* this is the default case, 28-bit digits */
|
/* this is the default case, 28-bit digits */
|
||||||
|
|
||||||
/* this is to make porting into LibTomCrypt easier :-) */
|
/* 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 uint32_t mp_digit;
|
||||||
typedef uint64_t mp_word;
|
typedef uint64_t mp_word;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user