Merge linux-stable 3.0.28 into android-3.0
[firefly-linux-kernel-4.4.55.git] / include / linux / kernel.h
index 47e8dbea85c893833d54069aab17e3af1021e6c7..da3e76d00105d5b8a129fec75f359c3397fe7142 100644 (file)
 }                                                      \
 )
 
+/*
+ * Multiplies an integer by a fraction, while avoiding unnecessary
+ * overflow or loss of precision.
+ */
+#define mult_frac(x, numer, denom)(                    \
+{                                                      \
+       typeof(x) quot = (x) / (denom);                 \
+       typeof(x) rem  = (x) % (denom);                 \
+       (quot * (numer)) + ((rem * (numer)) / (denom)); \
+}                                                      \
+)
+
+
 #define _RET_IP_               (unsigned long)__builtin_return_address(0)
 #define _THIS_IP_  ({ __label__ __here; __here: (unsigned long)&&__here; })