Skip to content

Commit

Permalink
added fxp_to_int() function
Browse files Browse the repository at this point in the history
  • Loading branch information
cfr34k committed Aug 6, 2016
1 parent 448c350 commit 035e7ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/fxp.h
Expand Up @@ -21,6 +21,7 @@ typedef int64_t fxp_tmp_t;
* FXP conversion functions
*/
fxp_t fxp_from_int(int32_t v);
int32_t fxp_to_int(fxp_t v);

fxp_t fxp_from_float(float v);
float fxp_to_float(fxp_t v);
Expand Down
5 changes: 5 additions & 0 deletions src/fxp_conv.c
Expand Up @@ -15,3 +15,8 @@ float fxp_to_float(fxp_t v)
return (float)v / (1 << POINTPOS);
}

int32_t fxp_to_int(fxp_t v)
{
return v >> POINTPOS;
}

0 comments on commit 035e7ec

Please sign in to comment.