[LITMUS^RT] [PATCH 1/2] Fix 64-bit division in fpmath.h

Christopher Kenna cjk at cs.unc.edu
Sun Sep 30 02:07:23 CEST 2012


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.
---
 include/litmus/fpmath.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/litmus/fpmath.h b/include/litmus/fpmath.h
index 04d4bca..642de98 100644
--- a/include/litmus/fpmath.h
+++ b/include/litmus/fpmath.h
@@ -1,6 +1,8 @@
 #ifndef __FP_MATH_H__
 #define __FP_MATH_H__
 
+#include <linux/math64.h>
+
 #ifndef __KERNEL__
 #include <stdint.h>
 #define abs(x) (((x) < 0) ? -(x) : x)
@@ -32,7 +34,7 @@ static inline fp_t FP(fpbuf_t x)
 /* divide two integers to obtain a fixed point value  */
 static inline fp_t _frac(fpbuf_t a, fpbuf_t b)
 {
-	return _fp(FP(a).val / (b));
+	return _fp(div64_s64(FP(a).val, (b)));
 }
 
 static inline fpbuf_t _point(fp_t x)
-- 
1.7.9.5





More information about the litmus-dev mailing list