15#define __round_mask(x, y) ((__typeof__(x))((y)-1))
25#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)
35#define round_down(x, y) ((x) & ~__round_mask(x, y))
46#define DIV_ROUND_UP_POW2(n, d) \
47 ((n) / (d) + !!((n) & ((d) - 1)))
49#define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP
51#define DIV_ROUND_DOWN_ULL(ll, d) \
52 ({ unsigned long long _tmp = (ll); do_div(_tmp, d); _tmp; })
54#define DIV_ROUND_UP_ULL(ll, d) \
55 DIV_ROUND_DOWN_ULL((unsigned long long)(ll) + (d) - 1, (d))
57#if BITS_PER_LONG == 32
58# define DIV_ROUND_UP_SECTOR_T(ll,d) DIV_ROUND_UP_ULL(ll, d)
60# define DIV_ROUND_UP_SECTOR_T(ll,d) DIV_ROUND_UP(ll,d)
71#define roundup(x, y) ( \
74 (((x) + (__y - 1)) / __y) * __y; \
85#define rounddown(x, y) ( \
87 typeof(x) __x = (x); \
92#define DIV_ROUND_CLOSEST __KERNEL_DIV_ROUND_CLOSEST
97#define DIV_ROUND_CLOSEST_ULL(x, divisor)( \
99 typeof(divisor) __d = divisor; \
100 unsigned long long _tmp = (x) + (__d) / 2; \
106#define __STRUCT_FRACT(type) \
107struct type##_fract { \
108 __##type numerator; \
109 __##type denominator; \
120#define mult_frac(x, n, d) \
122 typeof(x) x_ = (x); \
123 typeof(n) n_ = (n); \
124 typeof(d) d_ = (d); \
126 typeof(x_) q = x_ / d_; \
127 typeof(x_) r = x_ % d_; \
128 q * n_ + r * n_ / d_; \
131#define sector_div(a, b) do_div(a, b)
146#define abs(x) __abs_choose_expr(x, long long, \
147 __abs_choose_expr(x, long, \
148 __abs_choose_expr(x, int, \
149 __abs_choose_expr(x, short, \
150 __abs_choose_expr(x, char, \
151 __builtin_choose_expr( \
152 __builtin_types_compatible_p(typeof(x), char), \
153 (char)({ signed char __x = (x); __x<0?-__x:__x; }), \
156#define __abs_choose_expr(x, type, other) __builtin_choose_expr( \
157 __builtin_types_compatible_p(typeof(x), signed type) || \
158 __builtin_types_compatible_p(typeof(x), unsigned type), \
159 ({ signed type __x = (x); __x < 0 ? -__x : __x; }), other)
173#define abs_diff(a, b) ({ \
174 typeof(a) __a = (a); \
175 typeof(b) __b = (b); \
176 (void)(&__a == &__b); \
177 __a > __b ? (__a - __b) : (__b - __a); \
194static inline u32 reciprocal_scale(
u32 val,
u32 ep_ro)
196 return (
u32)(((
u64) val * ep_ro) >> 32);
202#if BITS_PER_LONG < 64
u64 int_pow(u64 base, unsigned int exp)
#define __STRUCT_FRACT(type)
Definition math.h:106
unsigned long int_sqrt(unsigned long)
float exp(float x)
Definition audioCtrl.cpp:53
struct i915_user_extension base
Definition i915_drm.h:0
uint64_t u64
Definition kernel.h:17
uint8_t u8
Definition kernel.h:14
int8_t s8
Definition kernel.h:18
int16_t s16
Definition kernel.h:19
uint16_t u16
Definition kernel.h:15
int32_t s32
Definition kernel.h:20
uint32_t u32
Definition kernel.h:16