📄 convertcoeff.c
字号:
/* --------------------------- includes ---------------------------- */
#include <stdlib.h>
#include <math.h>
#include <ops/custom_defs.h>
/* --------------------------- defines ----------------------------- */
#define COEFFSHIFT 29
/* ----------------------------------------------------------------- */
int roundingFloat( float data )
{
int help1, help2;
float help3, help4;
help1 = (int)(data + 0.5);
help2 = (int)(data - 0.5);
help3 = data - (float)help1;
help4 = data - (float)help2;
if( FABSVAL(help3) > FABSVAL(help4) )
return(help2);
else
return(help1);
}
int convertCoeff( int *dest, float *src, int length )
{
int i;
float shift;
shift = ( pow( 2.0, COEFFSHIFT) - 1.0 );
for( i=0; i<length; i++ )
dest[i] = roundingFloat( src[i]*shift );
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -