diff options
| author | Christopher Kenna <cjk@cs.unc.edu> | 2012-09-29 19:42:36 -0400 |
|---|---|---|
| committer | Christopher Kenna <cjk@cs.unc.edu> | 2012-09-29 19:51:12 -0400 |
| commit | 52c1d0b751f01183af81ed4e5f0de01f6cfc930d (patch) | |
| tree | d254e67534123b39843b8c3bfb6614437fea8622 | |
| parent | efbaa9ecdcc2a82d621bdd6b04319a982653c95c (diff) | |
Fix 64-bit division in fpmath.h
Commit e6f51fb826ce98d436f445aae4eb9e9dba1f30e8 added some floating
point support for LITMUS^RT, but it used 64-bit division that ARM does
not support. Therefore, use the division functions from math64.h.
| -rw-r--r-- | include/litmus/fpmath.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/litmus/fpmath.h b/include/litmus/fpmath.h index 04d4bcaeae9..642de98542c 100644 --- a/include/litmus/fpmath.h +++ b/include/litmus/fpmath.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #ifndef __FP_MATH_H__ | 1 | #ifndef __FP_MATH_H__ |
| 2 | #define __FP_MATH_H__ | 2 | #define __FP_MATH_H__ |
| 3 | 3 | ||
| 4 | #include <linux/math64.h> | ||
| 5 | |||
| 4 | #ifndef __KERNEL__ | 6 | #ifndef __KERNEL__ |
| 5 | #include <stdint.h> | 7 | #include <stdint.h> |
| 6 | #define abs(x) (((x) < 0) ? -(x) : x) | 8 | #define abs(x) (((x) < 0) ? -(x) : x) |
| @@ -32,7 +34,7 @@ static inline fp_t FP(fpbuf_t x) | |||
| 32 | /* divide two integers to obtain a fixed point value */ | 34 | /* divide two integers to obtain a fixed point value */ |
| 33 | static inline fp_t _frac(fpbuf_t a, fpbuf_t b) | 35 | static inline fp_t _frac(fpbuf_t a, fpbuf_t b) |
| 34 | { | 36 | { |
| 35 | return _fp(FP(a).val / (b)); | 37 | return _fp(div64_s64(FP(a).val, (b))); |
| 36 | } | 38 | } |
| 37 | 39 | ||
| 38 | static inline fpbuf_t _point(fp_t x) | 40 | static inline fpbuf_t _point(fp_t x) |
