Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of MiniTLS-GPL by
fp_2expt.c
00001 /* TomsFastMath, a fast ISO C bignum library. 00002 * 00003 * This project is meant to fill in where LibTomMath 00004 * falls short. That is speed ;-) 00005 * 00006 * This project is public domain and free for all purposes. 00007 * 00008 * Tom St Denis, tomstdenis@gmail.com 00009 */ 00010 #include <tfm.h> 00011 00012 /* computes a = 2**b */ 00013 void fp_2expt(fp_int *a, int b) 00014 { 00015 int z; 00016 00017 /* zero a as per default */ 00018 fp_zero (a); 00019 00020 if (b < 0) { 00021 return; 00022 } 00023 00024 z = b / DIGIT_BIT; 00025 if (z >= FP_SIZE) { 00026 return; 00027 } 00028 00029 /* set the used count of where the bit will go */ 00030 a->used = z + 1; 00031 00032 /* put the single bit in its place */ 00033 a->dp[z] = ((fp_digit)1) << (b % DIGIT_BIT); 00034 } 00035 00036 00037 /* $Source: /cvs/libtom/tomsfastmath/src/exptmod/fp_2expt.c,v $ */ 00038 /* $Revision: 1.1 $ */ 00039 /* $Date: 2006/12/31 21:25:53 $ */
Generated on Tue Jul 12 2022 19:20:10 by
1.7.2
