Subversion Repositories NaviCtrl

Rev

Rev 491 | Rev 493 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 491 Rev 492
Line 8... Line 8...
8
                                                //0  1  2  3  4   5   6   7   8   9   10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  37  38  38  40  41  42  43  44  45  46  47  48  49  50  51  52  53  54  55  56  57  58  59  60  61  62  63  64
8
                                                //0  1  2  3  4   5   6   7   8   9   10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  37  38  38  40  41  42  43  44  45  46  47  48  49  50  51  52  53  54  55  56  57  58  59  60  61  62  63  64
9
const s16 arccos64[65] = {90,89,88,87,86, 85, 84, 83, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 51, 50, 49, 48, 47, 45, 44, 43, 41, 40, 39, 37, 36, 34, 32, 31, 29, 27, 25, 23, 20, 18, 14, 10, 0};
9
const s16 arccos64[65] = {90,89,88,87,86, 85, 84, 83, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 51, 50, 49, 48, 47, 45, 44, 43, 41, 40, 39, 37, 36, 34, 32, 31, 29, 27, 25, 23, 20, 18, 14, 10, 0};
Line 10... Line 10...
10
 
10
 
11
s16 c_sin_8192(s16 angle)
11
s16 c_sin_8192(s16 angle)
12
{
12
{
13
        s8 m,n;
13
        s8 m, n;
Line 14... Line 14...
14
        s16 sinus;
14
        s16 sinus;
15
 
15
 
16
        // avoid negative angles
16
        // avoid negative angles
Line 121... Line 121...
121
                else q = -q;
121
                else q = -q;
122
        }
122
        }
123
        else if( x < 0) q = 4*((1<<15)-(1<<13)) - q;
123
        else if( x < 0) q = 4*((1<<15)-(1<<13)) - q;
124
        return(q);
124
        return(q);
125
}
125
}
-
 
126
 
-
 
127
 
-
 
128
 
-
 
129
// retuns the largest integer whose square is less than or equal to the
-
 
130
u32 isqrt(u32 value)
-
 
131
{
-
 
132
        u32 rem = 0, root  =0, idx;
-
 
133
       
-
 
134
        for(idx = 0; idx < 16; idx++)
-
 
135
        {
-
 
136
                root <<= 1;
-
 
137
       
-
 
138
                rem = ((rem << 2) + (value >> 30));
-
 
139
                value <<= 2;
-
 
140
                root++;
-
 
141
                if(root <= rem)
-
 
142
                {
-
 
143
                        rem -= root;
-
 
144
                        root++;
-
 
145
                }
-
 
146
                else
-
 
147
                {
-
 
148
                        root--;
-
 
149
                }
-
 
150
        }
-
 
151
        return(root >> 1);
-
 
152
}
-
 
153