Skip to content
Snippets Groups Projects
Commit 7b6760b0 authored by baewoojin's avatar baewoojin
Browse files

Update README.md

parent 3a01bb1b
Branches
No related tags found
No related merge requests found
...@@ -196,7 +196,7 @@ ...@@ -196,7 +196,7 @@
((fixed32)(((fa>>8)*(fb>>8))>>16)) ((fixed32)(((fa>>8)*(fb>>8))>>16))
~~~ ~~~
1. Same as above, the same fuction as fa*fb>>32, first multiply fa/2^8, fb/2^8, and divide the remaining 2^16 1. Same as above, the same fuction as fa*fb>>32, first multiply fa/2^8, fb/2^8, and divide the remaining 2^16
- a. div - b. div
- fx32_div - fx32_div
~~~ ~~~
(fixed32)( (((fixed64)(fa) << FX32_QNUM) /(fb))) (fixed32)( (((fixed64)(fa) << FX32_QNUM) /(fb)))
...@@ -212,3 +212,44 @@ ...@@ -212,3 +212,44 @@
((((fa)<<24)/(fb))<<8) ((((fa)<<24)/(fb))<<8)
~~~ ~~~
1. same as above, it has the same fuction as (fa<<32)/fb. First, fa is multiplied by 2^24, divided by fb, and then the remaining 2^8 is multiplied. 1. same as above, it has the same fuction as (fa<<32)/fb. First, fa is multiplied by 2^24, divided by fb, and then the remaining 2^8 is multiplied.
- c. sin
- sin table
~~~
const fixed32 fx32_SinTable[92] =
{
0,1143,2287,3429,4571,5711,6850,7986,9120,10252,11380,12504,13625,14742,15854,16961,18064,19160,20251,21336,22414,23486,24550,25606,26655, 27696,28729,29752,
30767,31772,32768,33753,34728,35693,36647,37589,38521,39440,40347,41243,42125,42995,43852,44695,45525,46340,47142, 47929,48702,49460,50203,50931,51643,52339,
53019,53683,54331,54963,55577,56175,56755,57319,57864,58393,58903,59395,59870,60326,60763, 61183,61583,61965,62328,62672,62997,63302,63589,63856,64103,64331,
64540,64729,64898,65047,65176,65286,65376,65446,65496,65526,65536,65526
};
~~~
- sin fuction
~~~
fixed32 fx32_sind(fixed32 fa)
{
int sign = 1;
fixed32 ret0, diff;
int idx;
if ( fa < 0 )
{
sign = -1;
fa *= -1;
}
fa = fa % FX32_360;
if ( fa >= FX32_180 )
{
sign *= -1;
fa -= FX32_180;
}
if ( fa > FX32_90 )
fa = FX32_180 - fa;
idx = fa>>16;
ret0 = fx32_SinTable[idx];
diff = fx32_SinTable[idx+1]-ret0;
return ( sign *( ret0 + ((diff*(fa&0xFFFF))>>16) ));
}
~~~
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment