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.
Dependents: MiniTLS-HTTPS-Example
s_fp_sub.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 /* unsigned subtraction ||a|| >= ||b|| ALWAYS! */ 00013 void s_fp_sub(fp_int *a, fp_int *b, fp_int *c) 00014 { 00015 int x, oldbused, oldused; 00016 fp_word t; 00017 00018 oldused = c->used; 00019 oldbused = b->used; 00020 c->used = a->used; 00021 t = 0; 00022 for (x = 0; x < oldbused; x++) { 00023 t = ((fp_word)a->dp[x]) - (((fp_word)b->dp[x]) + t); 00024 c->dp[x] = (fp_digit)t; 00025 t = (t >> DIGIT_BIT)&1; 00026 } 00027 for (; x < a->used; x++) { 00028 t = ((fp_word)a->dp[x]) - t; 00029 c->dp[x] = (fp_digit)t; 00030 t = (t >> DIGIT_BIT); 00031 } 00032 for (; x < oldused; x++) { 00033 c->dp[x] = 0; 00034 } 00035 fp_clamp(c); 00036 } 00037 00038 /* $Source: /cvs/libtom/tomsfastmath/src/addsub/s_fp_sub.c,v $ */ 00039 /* $Revision: 1.1 $ */ 00040 /* $Date: 2006/12/31 21:25:53 $ */
Generated on Wed Jul 13 2022 00:22:54 by
1.7.2