Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void sint(int* i, unsigned int e, const int s){
- const long a1=12868;
- const long a3=21167;
- const long a5=10445;
- const long a7=2455;
- int czy_ujemne;
- signed int x = 0;
- signed int y;
- int j;
- i[0] = 0;
- for(j=1; j < e; j++)
- {
- x=x+s;
- if(x<0){
- czy_ujemne = 1;
- }
- else{
- czy_ujemne = 0;
- }
- y = x < 0 ? -x : x;
- if (y > 16384){
- y=32767-y;
- }
- int z = _smpy(y,y);
- int b = _smpy(z,y); //y^3 Q15
- int c = _smpy(z,b);//y^5
- int d = _smpy(z,c);//y^7
- long szeregtay = a1*y-a3*b+a5*c-a7*d;
- if (czy_ujemne == 1){
- i[j] = -(int)((szeregtay+(1<<11))>>12);
- }
- else{
- i[j] = (int)((szeregtay+(1<<11))>>12);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment