for (i=1; i<=result[0]; i++) result[i] = (i==1);	        for (i=1; i<=temp[0]; i++) temp[i] = (i > r1[0] ? 0 : r1[i]);     bits = 1+msb(r2);  for (bit = 0; bit < bits; bit++) { digit = 1 + bit / 16; smallbit = bit % 16;  debug(temp); if (digit <= r2[0] && (r2[digit] & (1<<smallbit))) { dmsg(("bit %d\n", bit)); modmult(temp, result, modulus, tmp2); add(tmp2, Zero, result); debug(result);
for (mshift = 0; mshift < 15; mshift++) if ((m[0] << mshift) & 0x8000) break; if (mshift) { for (i = 0; i < mlen - 1; i++) m[i] = (m[i] << mshift) | (m[i+1] >> (16-mshift)); m[mlen-1] = m[mlen-1] << mshift;
static void modpow(Bignum r1, Bignum r2, Bignum modulus, Bignum result) {    Bignum temp = newbn(modulus[0]+1);    Bignum tmp2 = newbn(modulus[0]+1);    int i;    int bit, bits, digit, smallbit;    enter((">modpow\n"));    debug(r1);    debug(r2);    debug(modulus);    for (i=1; i<=result[0]; i++)	result[i] = (i==1);	       /* result := 1 */    for (i=1; i<=temp[0]; i++)	temp[i] = (i > r1[0] ? 0 : r1[i]);   /* temp := r1 */    bits = 1+msb(r2);    for (bit = 0; bit < bits; bit++) {	digit = 1 + bit / 16;	smallbit = bit % 16;	debug(temp);	if (digit <= r2[0] && (r2[digit] & (1<<smallbit))) {	    dmsg(("bit %d\n", bit));	    modmult(temp, result, modulus, tmp2);	    add(tmp2, Zero, result);	    debug(result);	}	modmult(temp, temp, modulus, tmp2);	add(tmp2, Zero, temp);    }    freebn(temp);    freebn(tmp2);    debug(result);    leave(("<modpow\n"));}