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
fp_cmp_d.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 /* compare against a single digit */ 00013 int fp_cmp_d(fp_int *a, fp_digit b) 00014 { 00015 /* compare based on sign */ 00016 if ((b && a->used == 0) || a->sign == FP_NEG) { 00017 return FP_LT; 00018 } 00019 00020 /* compare based on magnitude */ 00021 if (a->used > 1) { 00022 return FP_GT; 00023 } 00024 00025 /* compare the only digit of a to b */ 00026 if (a->dp[0] > b) { 00027 return FP_GT; 00028 } else if (a->dp[0] < b) { 00029 return FP_LT; 00030 } else { 00031 return FP_EQ; 00032 } 00033 00034 } 00035 00036 /* $Source: /cvs/libtom/tomsfastmath/src/addsub/fp_cmp_d.c,v $ */ 00037 /* $Revision: 1.1 $ */ 00038 /* $Date: 2006/12/31 21:25:53 $ */
Generated on Wed Jul 13 2022 00:22:54 by
1.7.2