| 1 |
/* { dg-options "-fdata-sections" { target { { ! { { hppa*-*-hpux* } && { ! lp64 } } } && { ! "nvptx-*-* pdp11-*-*" } } } } */ |
| 2 |
|
| 3 |
typedef unsigned char unit; |
| 4 |
typedef unit *unitptr; |
| 5 |
extern short global_precision; |
| 6 |
typedef __SIZE_TYPE__ size_t; |
| 7 |
extern void *memcpy (void *dest, const void *src, size_t n); |
| 8 |
|
| 9 |
short mp_compare(const unit* r1, const unit* r2) |
| 10 |
{ |
| 11 |
register short precision; |
| 12 |
precision = global_precision; |
| 13 |
(r1) = ((r1)+(precision)-1); |
| 14 |
(r2) = ((r2)+(precision)-1); |
| 15 |
do |
| 16 |
{ if (*r1 < *r2) |
| 17 |
return(-1); |
| 18 |
if (*((r1)--) > *((r2)--)) |
| 19 |
return(1); |
| 20 |
} while (--precision); |
| 21 |
} |
| 22 |
|
| 23 |
static unit modulus[((1280+(2*8))/8)]; |
| 24 |
static unit d_data[((1280+(2*8))/8)*2]; |
| 25 |
|
| 26 |
int upton_modmult (unitptr prod, unitptr multiplicand, unitptr multiplier) |
| 27 |
{ |
| 28 |
unitptr d = d_data; |
| 29 |
while (mp_compare(d,modulus) > 0) |
| 30 |
memcpy((void*)(prod), (const void*)(d), (global_precision)); |
| 31 |
} |