1 /* TomsFastMath, a fast ISO C bignum library. 2 * 3 * This project is meant to fill in where LibTomMath 4 * falls short. That is speed ;-) 5 * 6 * This project is public domain and free for all purposes. 7 * 8 * Tom St Denis, tomstdenis@gmail.com 9 */ 10 #include "bignum_fast.h" 11 12 /* computes a = 2**b */ fp_2expt(fp_int * a,int b)13void fp_2expt(fp_int *a, int b) 14 { 15 int z; 16 17 /* zero a as per default */ 18 fp_zero (a); 19 20 if (b < 0) { 21 return; 22 } 23 24 z = b / DIGIT_BIT; 25 if (z >= FP_SIZE) { 26 return; 27 } 28 29 /* set the used count of where the bit will go */ 30 a->used = z + 1; 31 32 /* put the single bit in its place */ 33 a->dp[z] = ((fp_digit)1) << (b % DIGIT_BIT); 34 } 35 36 37 /* $Source: /cvs/libtom/tomsfastmath/src/exptmod/fp_2expt.c,v $ */ 38 /* $Revision: 1.1 $ */ 39 /* $Date: 2006/12/31 21:25:53 $ */ 40