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
fp_ident(void)12 const char *fp_ident(void)
13 {
14 static char buf[1024];
15
16 memset(buf, 0, sizeof(buf));
17 snprintf(buf, sizeof(buf)-1,
18 "TomsFastMath (%s)\n"
19 "\n"
20 "Sizeofs\n"
21 "\tfp_digit = %llu\n"
22 "\tfp_word = %llu\n"
23 "\n"
24 "FP_MAX_SIZE = %u\n"
25 "\n"
26 "Defines: \n"
27 #ifdef __i386__
28 " __i386__ "
29 #endif
30 #ifdef __x86_64__
31 " __x86_64__ "
32 #endif
33 #ifdef TFM_X86
34 " TFM_X86 "
35 #endif
36 #ifdef TFM_X86_64
37 " TFM_X86_64 "
38 #endif
39 #ifdef TFM_SSE2
40 " TFM_SSE2 "
41 #endif
42 #ifdef TFM_ARM
43 " TFM_ARM "
44 #endif
45 #ifdef TFM_PPC32
46 " TFM_PPC32 "
47 #endif
48 #ifdef TFM_AVR32
49 " TFM_AVR32 "
50 #endif
51 #ifdef TFM_ECC192
52 " TFM_ECC192 "
53 #endif
54 #ifdef TFM_ECC224
55 " TFM_ECC224 "
56 #endif
57 #ifdef TFM_ECC384
58 " TFM_ECC384 "
59 #endif
60 #ifdef TFM_ECC521
61 " TFM_ECC521 "
62 #endif
63
64 #ifdef TFM_NO_ASM
65 " TFM_NO_ASM "
66 #endif
67 #ifdef FP_64BIT
68 " FP_64BIT "
69 #endif
70 #ifdef TFM_HUGE
71 " TFM_HUGE "
72 #endif
73 "\n", __DATE__, (long long unsigned)sizeof(fp_digit), (long long unsigned)sizeof(fp_word), FP_MAX_SIZE);
74
75 if (sizeof(fp_digit) == sizeof(fp_word)) {
76 strncat(buf, "WARNING: sizeof(fp_digit) == sizeof(fp_word), this build is likely to not work properly.\n",
77 sizeof(buf)-strlen(buf)-1);
78 }
79 return buf;
80 }
81
82 #ifdef STANDALONE
83
main(void)84 int main(void)
85 {
86 printf("%s\n", fp_ident());
87 return 0;
88 }
89
90 #endif
91
92
93 /* $Source: /cvs/libtom/tomsfastmath/src/misc/fp_ident.c,v $ */
94 /* $Revision: 1.1 $ */
95 /* $Date: 2006/12/31 21:25:53 $ */
96