diff options
-rw-r--r-- | security/nss/lib/freebl/mpi/montmulf.c | 38 | ||||
-rw-r--r-- | security/nss/lib/freebl/mpi/montmulf.h | 4 | ||||
-rw-r--r-- | security/nss/lib/freebl/mpi/montmulf.il | 58 |
3 files changed, 23 insertions, 77 deletions
diff --git a/security/nss/lib/freebl/mpi/montmulf.c b/security/nss/lib/freebl/mpi/montmulf.c index 751602d7f..e8d100f49 100644 --- a/security/nss/lib/freebl/mpi/montmulf.c +++ b/security/nss/lib/freebl/mpi/montmulf.c @@ -16,6 +16,7 @@ * Copyright (C) 1999-2000 Sun Microsystems Inc. All Rights Reserved. * * Contributor(s): + * Netscape Communications Corporation * * Alternatively, the contents of this file may be used under the * terms of the GNU General Public License Version 2 or later (the @@ -34,11 +35,11 @@ #define RF_INLINE_MACROS -static double TwoTo16=65536.0; -static double TwoToMinus16=1.0/65536.0; -static double Zero=0.0; -static double TwoTo32=65536.0*65536.0; -static double TwoToMinus32=1.0/(65536.0*65536.0); +static const double TwoTo16=65536.0; +static const double TwoToMinus16=1.0/65536.0; +static const double Zero=0.0; +static const double TwoTo32=65536.0*65536.0; +static const double TwoToMinus32=1.0/(65536.0*65536.0); #ifdef RF_INLINE_MACROS @@ -46,6 +47,14 @@ double upper32(double); double lower32(double, double); double mod(double, double, double); +void i16_to_d16_and_d32x4(const double * /*1/(2^16)*/, + const double * /* 2^16*/, + const double * /* 0 */, + double * /*result16*/, + double * /* result32 */, + float * /*source - should be unsigned int* + converted to float* */); + #else static double upper32(double x) @@ -66,7 +75,7 @@ static double mod(double x, double oneoverm, double m) #endif -void cleanup(double *dt, int from, int tlen) +static void cleanup(double *dt, int from, int tlen) { int i; double tmp,tmp1,x,x1; @@ -149,30 +158,24 @@ unsigned int a; } -void i16_to_d16_and_d32x4(double * /*1/(2^16)*/, double * /* 2^16*/, - double * /* 0 */, - double * /*result16*/, double * /* result32 */, - float * /*source - should be unsigned int* - converted to float* */); - - - void conv_i32_to_d32_and_d16(double *d32, double *d16, unsigned int *i32, int len) { -int i; +int i = 0; unsigned int a; #pragma pipeloop(0) - for(i=0;i<len-3;i+=4) +#ifdef RF_INLINE_MACROS + for(;i<len-3;i+=4) { i16_to_d16_and_d32x4(&TwoToMinus16, &TwoTo16, &Zero, &(d16[2*i]), &(d32[i]), (float *)(&(i32[i]))); } +#endif for(;i<len;i++) { a=i32[i]; - d32[i]=(double)(i32[i]); + d32[i]=(double)(a); d16[2*i]=(double)(a&0xffff); d16[2*i+1]=(double)(a>>16); } @@ -206,7 +209,6 @@ int i; -void cleanup(double *dt, int from, int tlen); /* ** the lengths of the input arrays should be at least the following: diff --git a/security/nss/lib/freebl/mpi/montmulf.h b/security/nss/lib/freebl/mpi/montmulf.h index af36f5b78..5fd5dd4e3 100644 --- a/security/nss/lib/freebl/mpi/montmulf.h +++ b/security/nss/lib/freebl/mpi/montmulf.h @@ -16,6 +16,7 @@ * Copyright (C) 1999-2000 Sun Microsystems Inc. All Rights Reserved. * * Contributor(s): + * Netscape Communications Corporation * * Alternatively, the contents of this file may be used under the * terms of the GNU General Public License Version 2 or later (the @@ -86,11 +87,12 @@ void mont_mulf_noconv(unsigned int *result, * Note that m1 and m2 should both be of length nlen, so they should be * padded with 0's if necessary before the conversion. The result comes in * this form (int representation, padded with 0's). + * dn0 is the value of the 16 least significant bits of n0'. * The function does not allocate memory for any of the arrays, so the * pointers should point to arrays with the following minimal sizes: * result - nlen+1 * dm1 - nlen - * dm2 - 2*nlen+1 /* the +1 is necessary for technical reasons */ + * dm2 - 2*nlen+1 ( the +1 is necessary for technical reasons ) * dt - 4*nlen+2 * dn - nlen * nint - nlen diff --git a/security/nss/lib/freebl/mpi/montmulf.il b/security/nss/lib/freebl/mpi/montmulf.il index 18aa47b80..b3dd734b6 100644 --- a/security/nss/lib/freebl/mpi/montmulf.il +++ b/security/nss/lib/freebl/mpi/montmulf.il @@ -77,58 +77,6 @@ ! -! void separate16(double * /*1/(2^16)*/, double * /* 2^16*/, -! double * /*result*/ -! float * /*source - should be unsigned int* -! converted to float* */); -! - .inline separate16,20 - ldd [%o0],%f2 ! 1/(2^16) - ldd [%o1],%f4 ! 2^16 - - ld [%o3],%f7 - fmovs %f5,%f6 - ld [%o3+4],%f11 - fmovs %f5,%f10 - ld [%o3+8],%f15 - fmovs %f5,%f14 - ld [%o3+12],%f19 - fmovs %f5,%f18 - fxtod %f6,%f6 - fxtod %f10,%f10 - fxtod %f14,%f14 - fxtod %f18,%f18 - fmuld %f2,%f6,%f8 - fmuld %f2,%f10,%f12 - fmuld %f2,%f14,%f16 - fmuld %f2,%f18,%f20 - fdtox %f8,%f8 - fdtox %f12,%f12 - fdtox %f16,%f16 - fdtox %f20,%f20 - fxtod %f8,%f8 - std %f8,[%o2+8] - fxtod %f12,%f12 - std %f12,[%o2+24] - fxtod %f16,%f16 - std %f16,[%o2+40] - fxtod %f20,%f20 - std %f20,[%o2+56] - fmuld %f8,%f4,%f8 - fmuld %f12,%f4,%f12 - fmuld %f16,%f4,%f16 - fmuld %f20,%f4,%f20 - fsubd %f6,%f8,%f8 - std %f8,[%o2] - fsubd %f10,%f12,%f12 - std %f12,[%o2+16] - fsubd %f14,%f16,%f16 - std %f16,[%o2+32] - fsubd %f18,%f20,%f20 - std %f20,[%o2+48] - .end - -! ! void i16_to_d16_and_d32x4(double * /*1/(2^16)*/, double * /* 2^16*/, ! double * /* 0 */, ! double * /*result16*/, double * /* result32 */ @@ -187,9 +135,3 @@ .end -! -! unsigned long long tick(); -! - .inline tick,0 - rd %tick,%o0 - .end |