implement macros for fp multiplication and division
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user