~ubuntu-branches/ubuntu/utopic/clamav/utopic-security

« back to all changes in this revision

Viewing changes to libclamav/tomsfastmath/sqr/fp_sqr.c

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman
  • Date: 2014-02-01 11:06:17 UTC
  • mfrom: (0.35.37 sid)
  • Revision ID: package-import@ubuntu.com-20140201110617-33h2xxk09dep0ui4
Tags: 0.98.1+dfsg-1ubuntu1
* Merge from Debian unstable.  Remaining changes:
  - Drop build-dep on electric-fence (in Universe)
  - Add apparmor profiles for clamd and freshclam along with maintainer
    script changes
  - Add autopkgtest

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
12
/* b = a*a  */
 
13
void fp_sqr(fp_int *A, fp_int *B)
 
14
{
 
15
    int     y;
 
16
 
 
17
    /* call generic if we're out of range */
 
18
    if (A->used + A->used > FP_SIZE) {
 
19
       fp_sqr_comba(A, B);
 
20
       return ;
 
21
    }
 
22
 
 
23
    y = A->used;
 
24
#if defined(TFM_SQR3)
 
25
        if (y <= 3) {
 
26
           fp_sqr_comba3(A,B);
 
27
           return;
 
28
        }
 
29
#endif
 
30
#if defined(TFM_SQR4)
 
31
        if (y == 4) {
 
32
           fp_sqr_comba4(A,B);
 
33
           return;
 
34
        }
 
35
#endif
 
36
#if defined(TFM_SQR6)
 
37
        if (y <= 6) {
 
38
           fp_sqr_comba6(A,B);
 
39
           return;
 
40
        }
 
41
#endif
 
42
#if defined(TFM_SQR7)
 
43
        if (y == 7) {
 
44
           fp_sqr_comba7(A,B);
 
45
           return;
 
46
        }
 
47
#endif
 
48
#if defined(TFM_SQR8)
 
49
        if (y == 8) {
 
50
           fp_sqr_comba8(A,B);
 
51
           return;
 
52
        }
 
53
#endif
 
54
#if defined(TFM_SQR9)
 
55
        if (y == 9) {
 
56
           fp_sqr_comba9(A,B);
 
57
           return;
 
58
        }
 
59
#endif
 
60
#if defined(TFM_SQR12)
 
61
        if (y <= 12) {
 
62
           fp_sqr_comba12(A,B);
 
63
           return;
 
64
        }
 
65
#endif
 
66
#if defined(TFM_SQR17)
 
67
        if (y <= 17) {
 
68
           fp_sqr_comba17(A,B);
 
69
           return;
 
70
        }
 
71
#endif
 
72
#if defined(TFM_SMALL_SET)
 
73
        if (y <= 16) {
 
74
           fp_sqr_comba_small(A,B);
 
75
           return;
 
76
        }
 
77
#endif
 
78
#if defined(TFM_SQR20)
 
79
        if (y <= 20) {
 
80
           fp_sqr_comba20(A,B);
 
81
           return;
 
82
        }
 
83
#endif
 
84
#if defined(TFM_SQR24)
 
85
        if (y <= 24) {
 
86
           fp_sqr_comba24(A,B);
 
87
           return;
 
88
        }
 
89
#endif
 
90
#if defined(TFM_SQR28)
 
91
        if (y <= 28) {
 
92
           fp_sqr_comba28(A,B);
 
93
           return;
 
94
        }
 
95
#endif
 
96
#if defined(TFM_SQR32)
 
97
        if (y <= 32) {
 
98
           fp_sqr_comba32(A,B);
 
99
           return;
 
100
        }
 
101
#endif
 
102
#if defined(TFM_SQR48)
 
103
        if (y <= 48) {
 
104
           fp_sqr_comba48(A,B);
 
105
           return;
 
106
        }
 
107
#endif
 
108
#if defined(TFM_SQR64)
 
109
        if (y <= 64) {
 
110
           fp_sqr_comba64(A,B);
 
111
           return;
 
112
        }
 
113
#endif
 
114
       fp_sqr_comba(A, B);
 
115
}
 
116
 
 
117
 
 
118
/* $Source: /cvs/libtom/tomsfastmath/src/sqr/fp_sqr.c,v $ */
 
119
/* $Revision: 1.1 $ */
 
120
/* $Date: 2006/12/31 21:25:53 $ */