comparison tomsfastmath/src/misc/fp_ident.c @ 643:a362b62d38b2 dropbear-tfm

Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a with Makefile.in renamed
author Matt Johnston <matt@ucc.asn.au>
date Wed, 23 Nov 2011 18:10:20 +0700
parents
children
comparison
equal deleted inserted replaced
642:33fd2f3499d2 643:a362b62d38b2
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, [email protected]
9 */
10 #include "tfm.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 (%s)\n"
19 "\n"
20 "Sizeofs\n"
21 "\tfp_digit = %u\n"
22 "\tfp_word = %u\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__, sizeof(fp_digit), 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)-1);
78 }
79 return buf;
80 }
81
82 #ifdef STANDALONE
83
84 int main(void)
85 {
86 printf("%s\n", fp_ident());
87 return 0;
88 }
89
90 #endif
91
92
93 /* $Source$ */
94 /* $Revision$ */
95 /* $Date$ */