From 58f1673186a41b396d4ca4e13f43b502a305bf01 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 16 Dec 2022 13:40:45 +0000 Subject: api: fpmath: Add macro to get fractional part --- include/libcss/fpmath.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/libcss/fpmath.h b/include/libcss/fpmath.h index d7cac4d..eec40b3 100644 --- a/include/libcss/fpmath.h +++ b/include/libcss/fpmath.h @@ -130,6 +130,8 @@ css_float_to_fixed(const float a) { /* truncate a fixed point value */ #define TRUNCATEFIX(a) (a & ~((1 << CSS_RADIX_POINT)- 1 )) +/* get fractional component of a fixed point value */ +#define FIXFRAC(a) (a & ((1 << CSS_RADIX_POINT)- 1 )) /* Useful values */ #define F_PI_2 0x00000648 /* 1.5708 (PI/2) */ -- cgit v1.2.1