X-Git-Url: https://git.rohieb.name/hackover2013-badge-firmware.git/blobdiff_plain/4cb2d309b35bc7acc33483bdcd0af2a749206369..2fb9f70df407a731f55952a7e70eea641ad275d9:/badge/util/fixed_point.h diff --git a/badge/util/fixed_point.h b/badge/util/fixed_point.h index 8af7e82..49bfa7c 100644 --- a/badge/util/fixed_point.h +++ b/badge/util/fixed_point.h @@ -25,12 +25,12 @@ static inline bool fixed_point_ne(fixed_point x, fixed_point y) { return x.data #define FIXED_POINT_I(x, y) { ((x) * 256) + ((y) * 256 / 1000) } #define FIXED_INT_I(x) FIXED_POINT_I(x, 0) -static inline fixed_point FIXED_POINT(unsigned x, unsigned y) { - fixed_point r = { ((int) x * 256) + ((int) y * 256 / 1000) }; +static inline fixed_point FIXED_POINT(int32_t x, int32_t y) { + fixed_point r = { (x * 256) + (y * 256 / 1000) }; return r; } -static inline fixed_point FIXED_INT(unsigned x) { return FIXED_POINT(x, 0); } +static inline fixed_point FIXED_INT(int32_t x) { return FIXED_POINT(x, 0); } static inline int fixed_point_cast_int(fixed_point x) { return x.data / 256; }