implement macros for fp multiplication and division

This commit is contained in:
EDiasAlberto
2024-10-15 15:24:34 +01:00
parent 1f1ffe4470
commit 724b6065f7

View File

@@ -18,6 +18,9 @@
#define FP_SUBTRACT_INT(x, n) ((x) - ((n) * (CONVERSION_CONST))) #define FP_SUBTRACT_INT(x, n) ((x) - ((n) * (CONVERSION_CONST)))
/* Fixed Point Arithmetic multiplication operations */ /* Fixed Point Arithmetic multiplication operations */
#define FP_MULTIPLY(x, y) ((int64_t)(x)) * (y) / (CONVERSION_CONST)
#define FP_MULTIPLY_INT(x, n) ((x) * (n))
#define FP_DIVIDE(x, y) ((int64_t)(x)) * (CONVERSION_CONST) / (y)
#define FP_DIVIDE_INT(x, n) ((x) / (n))
#endif //FIXED_POINT_H #endif //FIXED_POINT_H