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_sqr.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 /* b = a*a */ 00013 void fp_sqr(fp_int *A, fp_int *B) 00014 { 00015 int y; 00016 00017 /* call generic if we're out of range */ 00018 if (A->used + A->used > FP_SIZE) { 00019 fp_sqr_comba(A, B); 00020 return ; 00021 } 00022 00023 y = A->used; 00024 #if defined(TFM_SQR3) 00025 if (y <= 3) { 00026 fp_sqr_comba3(A,B); 00027 return; 00028 } 00029 #endif 00030 #if defined(TFM_SQR4) 00031 if (y == 4) { 00032 fp_sqr_comba4(A,B); 00033 return; 00034 } 00035 #endif 00036 #if defined(TFM_SQR6) 00037 if (y <= 6) { 00038 fp_sqr_comba6(A,B); 00039 return; 00040 } 00041 #endif 00042 #if defined(TFM_SQR7) 00043 if (y == 7) { 00044 fp_sqr_comba7(A,B); 00045 return; 00046 } 00047 #endif 00048 #if defined(TFM_SQR8) 00049 if (y == 8) { 00050 fp_sqr_comba8(A,B); 00051 return; 00052 } 00053 #endif 00054 #if defined(TFM_SQR9) 00055 if (y == 9) { 00056 fp_sqr_comba9(A,B); 00057 return; 00058 } 00059 #endif 00060 #if defined(TFM_SQR12) 00061 if (y <= 12) { 00062 fp_sqr_comba12(A,B); 00063 return; 00064 } 00065 #endif 00066 #if defined(TFM_SQR17) 00067 if (y <= 17) { 00068 fp_sqr_comba17(A,B); 00069 return; 00070 } 00071 #endif 00072 #if defined(TFM_SMALL_SET) 00073 if (y <= 16) { 00074 fp_sqr_comba_small(A,B); 00075 return; 00076 } 00077 #endif 00078 #if defined(TFM_SQR20) 00079 if (y <= 20) { 00080 fp_sqr_comba20(A,B); 00081 return; 00082 } 00083 #endif 00084 #if defined(TFM_SQR24) 00085 if (y <= 24) { 00086 fp_sqr_comba24(A,B); 00087 return; 00088 } 00089 #endif 00090 #if defined(TFM_SQR28) 00091 if (y <= 28) { 00092 fp_sqr_comba28(A,B); 00093 return; 00094 } 00095 #endif 00096 #if defined(TFM_SQR32) 00097 if (y <= 32) { 00098 fp_sqr_comba32(A,B); 00099 return; 00100 } 00101 #endif 00102 #if defined(TFM_SQR48) 00103 if (y <= 48) { 00104 fp_sqr_comba48(A,B); 00105 return; 00106 } 00107 #endif 00108 #if defined(TFM_SQR64) 00109 if (y <= 64) { 00110 fp_sqr_comba64(A,B); 00111 return; 00112 } 00113 #endif 00114 fp_sqr_comba(A, B); 00115 } 00116 00117 00118 /* $Source: /cvs/libtom/tomsfastmath/src/sqr/fp_sqr.c,v $ */ 00119 /* $Revision: 1.1 $ */ 00120 /* $Date: 2006/12/31 21:25:53 $ */
Generated on Tue Jul 12 2022 19:20:10 by
1.7.2
