]> pd.if.org Git - zpackage/blob - tomsfastmath/src/misc/fp_ident.c
commit files needed for zpm-fetchurl
[zpackage] / tomsfastmath / src / misc / fp_ident.c
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 <tfm_private.h>
11
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 " TFM_VERSION_S "\n"
19 #if defined(TFM_IDENT_BUILD_DATE)
20 "Built on " __DATE__ " at " __TIME__ "\n"
21 #endif
22 "\n"
23 "Sizeofs\n"
24 "\tfp_digit = %lu\n"
25 "\tfp_word  = %lu\n"
26 "\n"
27 "FP_MAX_SIZE = %u\n"
28 "\n"
29 "Defines: \n"
30 #ifdef __i386__
31 " __i386__ "
32 #endif
33 #ifdef __x86_64__
34 " __x86_64__ "
35 #endif
36 #ifdef TFM_X86
37 " TFM_X86 "
38 #endif
39 #ifdef TFM_X86_64
40 " TFM_X86_64 "
41 #endif
42 #ifdef TFM_SSE2
43 " TFM_SSE2 "
44 #endif
45 #ifdef TFM_ARM
46 " TFM_ARM "
47 #endif
48 #ifdef TFM_PPC32
49 " TFM_PPC32 "
50 #endif
51 #ifdef TFM_AVR32
52 " TFM_AVR32 "
53 #endif
54 #ifdef TFM_ECC192
55 " TFM_ECC192 "
56 #endif
57 #ifdef TFM_ECC224
58 " TFM_ECC224 "
59 #endif
60 #ifdef TFM_ECC384
61 " TFM_ECC384 "
62 #endif
63 #ifdef TFM_ECC521
64 " TFM_ECC521 "
65 #endif
66
67 #ifdef TFM_NO_ASM
68 " TFM_NO_ASM "
69 #endif
70 #ifdef FP_64BIT
71 " FP_64BIT "
72 #endif
73 #ifdef TFM_HUGE
74 " TFM_HUGE "
75 #endif
76 "\n", (unsigned long)sizeof(fp_digit), (unsigned long)sizeof(fp_word), FP_MAX_SIZE);
77
78    if (sizeof(fp_digit) == sizeof(fp_word)) {
79       strncat(buf, "WARNING: sizeof(fp_digit) == sizeof(fp_word), this build is likely to not work properly.\n",
80               sizeof(buf) - strlen(buf) - 1);
81    }
82    return buf;
83 }
84
85 #ifdef STANDALONE
86
87 int main(void)
88 {
89    printf("%s\n", fp_ident());
90    return 0;
91 }
92
93 #endif
94
95
96 /* $Source$ */
97 /* $Revision$ */
98 /* $Date$ */