2
Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
4
This file is part of the GNU MP Library.
6
The GNU MP Library is free software; you can redistribute it and/or modify
7
it under the terms of the GNU Lesser General Public License as published by
8
the Free Software Foundation; either version 2.1 of the License, or (at your
9
option) any later version.
11
The GNU MP Library is distributed in the hope that it will be useful, but
12
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14
License for more details.
16
You should have received a copy of the GNU Lesser General Public License
17
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
18
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
27
#if defined (USG) || defined (__SVR4) || defined (_UNICOS) || defined (__hpux) || (defined(__DECC) && defined(__VMS))
33
if (CLOCKS_PER_SEC < 100000)
34
return clock () * 1000 / CLOCKS_PER_SEC;
35
return clock () / (CLOCKS_PER_SEC / 1000);
38
#include <sys/types.h>
40
#include <sys/resource.h>
48
return rus.ru_utime.tv_sec * 1000 + rus.ru_utime.tv_usec / 1000;
55
#if defined (__m88k__)
57
#elif defined (__i386__)
58
#define CLOCK (16666667)
59
#elif defined (__m68k__)
61
#elif defined (_IBMR2)
63
#elif defined (__sparc__)
65
#elif defined (__sun__)
67
#elif defined (__mips)
69
#elif defined (__hppa__)
71
#elif defined (__alpha)
76
#error "Don't know CLOCK of your machine"
87
#define TIMES OPS/SIZE
90
#define OPS (SIZE*TIMES)
95
mp_limb_t nptr[2 * SIZE];
96
mp_limb_t dptr[2 * SIZE];
97
mp_limb_t qptr[2 * SIZE];
98
mp_limb_t pptr[2 * SIZE + 1];
99
mp_limb_t rptr[2 * SIZE];
100
mp_size_t nsize, dsize, qsize, rsize, psize;
105
clock_mhz = CLOCK / 1000000;
106
printf("\r\nTest Times Are Based On A CPU Clock Speed Of %dMHz.\r\n\r\n",clock_mhz);
108
for (test = 0; ; test++)
110
printf ("%d\n", test);
112
nsize = random () % (2 * SIZE) + 1;
113
dsize = random () % nsize + 1;
119
mpn_random2 (nptr, nsize);
120
mpn_random2 (dptr, dsize);
121
dptr[dsize - 1] |= (mp_limb_t) 1 << (BITS_PER_MP_LIMB - 1);
123
MPN_COPY (rptr, nptr, nsize);
124
qlimb = mpn_divrem (qptr, (mp_size_t) 0, rptr, nsize, dptr, dsize);
126
qsize = nsize - dsize;
129
if (qsize == 0 || qsize > 2 * SIZE)
131
continue; /* bogus */
137
mpn_mul (pptr, qptr, qsize, dptr, dsize);
139
mpn_mul (pptr, dptr, dsize, qptr, qsize);
140
psize = qsize + dsize;
141
psize -= pptr[psize - 1] == 0;
142
cy = mpn_add (pptr, pptr, psize, rptr, rsize);
147
if (nsize != psize || mpn_cmp (nptr, pptr, nsize) != 0)