demo/test: fix some compiler warnings
This commit is contained in:
parent
019beee1c7
commit
c81aac2674
139
demo/test.c
139
demo/test.c
@ -1,5 +1,7 @@
|
|||||||
/* TFM demo program */
|
/* TFM demo program */
|
||||||
#include <tfm.h>
|
#include <tfm.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
void draw(fp_int *a)
|
void draw(fp_int *a)
|
||||||
{
|
{
|
||||||
@ -27,9 +29,12 @@ static ulong64 TIMFUNC (void)
|
|||||||
asm ("rdtsc":"=A"(a));
|
asm ("rdtsc":"=A"(a));
|
||||||
return a;
|
return a;
|
||||||
#elif defined(__i386__) || defined(__x86_64__)
|
#elif defined(__i386__) || defined(__x86_64__)
|
||||||
ulong64 a;
|
/* version from http://www.mcs.anl.gov/~kazutomo/rdtsc.html
|
||||||
__asm__ __volatile__ ("rdtsc\nmovl %%eax,%0\nmovl %%edx,4+%0\n"::"m"(a):"%eax","%edx");
|
* the old code always got a warning issued by gcc, clang did not complain...
|
||||||
return a;
|
*/
|
||||||
|
unsigned hi, lo;
|
||||||
|
__asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
|
||||||
|
return ((ulong64)lo)|( ((ulong64)hi)<<32);
|
||||||
#elif defined(TFM_PPC32)
|
#elif defined(TFM_PPC32)
|
||||||
unsigned long a, b;
|
unsigned long a, b;
|
||||||
__asm__ __volatile__ ("mftbu %1 \nmftb %0\n":"=r"(a), "=r"(b));
|
__asm__ __volatile__ ("mftbu %1 \nmftb %0\n":"=r"(a), "=r"(b));
|
||||||
@ -522,70 +527,70 @@ monttime:
|
|||||||
t2 = -1;
|
t2 = -1;
|
||||||
for (ix = 0; ix < 100; ++ix) {
|
for (ix = 0; ix < 100; ++ix) {
|
||||||
t1 = TIMFUNC();
|
t1 = TIMFUNC();
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
fp_montgomery_reduce(&c, &a, &fp);
|
fp_montgomery_reduce(&c, &a, fp);
|
||||||
fp_montgomery_reduce(&d, &a, &fp);
|
fp_montgomery_reduce(&d, &a, fp);
|
||||||
t2 = (TIMFUNC() - t1)>>6;
|
t2 = (TIMFUNC() - t1)>>6;
|
||||||
fp_copy(&b, &c);
|
fp_copy(&b, &c);
|
||||||
fp_copy(&b, &d);
|
fp_copy(&b, &d);
|
||||||
|
Loading…
Reference in New Issue
Block a user