Lines Matching +full:1 +full:a
4 * Permission is hereby granted, free of charge, to any person obtaining a
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
37 #define dfixed_const(A) (u32)(((A) << 12))/* + ((B + 0.000122)*4096)) */ argument
38 #define dfixed_const_half(A) (u32)(((A) << 12) + 2048) argument
39 #define dfixed_const_666(A) (u32)(((A) << 12) + 2731) argument
40 #define dfixed_const_8(A) (u32)(((A) << 12) + 3277) argument
41 #define dfixed_mul(A, B) ((u64)((u64)(A).full * (B).full + 2048) >> 12) argument
42 #define dfixed_init(A) { .full = dfixed_const((A)) } argument
43 #define dfixed_init_half(A) { .full = dfixed_const_half((A)) } argument
44 #define dfixed_trunc(A) ((A).full >> 12) argument
45 #define dfixed_frac(A) ((A).full & ((1 << 12) - 1)) argument
47 static inline u32 dfixed_floor(fixed20_12 A) in dfixed_floor() argument
49 u32 non_frac = dfixed_trunc(A); in dfixed_floor()
54 static inline u32 dfixed_ceil(fixed20_12 A) in dfixed_ceil() argument
56 u32 non_frac = dfixed_trunc(A); in dfixed_ceil()
58 if (A.full > dfixed_const(non_frac)) in dfixed_ceil()
59 return dfixed_const(non_frac + 1); in dfixed_ceil()
64 static inline u32 dfixed_div(fixed20_12 A, fixed20_12 B) in dfixed_div() argument
66 u64 tmp = ((u64)A.full << 13); in dfixed_div()
69 tmp += 1; in dfixed_div()
75 #define DRM_FIXED_ONE (1ULL << DRM_FIXED_POINT)
76 #define DRM_FIXED_DECIMAL_MASK (DRM_FIXED_ONE - 1)
78 #define DRM_FIXED_EPSILON 1LL
81 static inline s64 drm_int2fixp(int a) in drm_int2fixp() argument
83 return ((s64)a) << DRM_FIXED_POINT; in drm_int2fixp()
86 static inline int drm_fixp2int(s64 a) in drm_fixp2int() argument
88 return ((s64)a) >> DRM_FIXED_POINT; in drm_fixp2int()
91 static inline int drm_fixp2int_round(s64 a) in drm_fixp2int_round() argument
93 return drm_fixp2int(a + DRM_FIXED_ONE / 2); in drm_fixp2int_round()
96 static inline int drm_fixp2int_ceil(s64 a) in drm_fixp2int_ceil() argument
98 if (a >= 0) in drm_fixp2int_ceil()
99 return drm_fixp2int(a + DRM_FIXED_ALMOST_ONE); in drm_fixp2int_ceil()
101 return drm_fixp2int(a - DRM_FIXED_ALMOST_ONE); in drm_fixp2int_ceil()
104 static inline unsigned drm_fixp_msbset(s64 a) in drm_fixp_msbset() argument
106 unsigned shift, sign = (a >> 63) & 1; in drm_fixp_msbset()
109 if (((a >> shift) & 1) != sign) in drm_fixp_msbset()
115 static inline s64 drm_fixp_mul(s64 a, s64 b) in drm_fixp_mul() argument
117 unsigned shift = drm_fixp_msbset(a) + drm_fixp_msbset(b); in drm_fixp_mul()
122 a >>= (shift >> 1) + (shift & 1); in drm_fixp_mul()
123 b >>= shift >> 1; in drm_fixp_mul()
127 result = a * b; in drm_fixp_mul()
138 static inline s64 drm_fixp_div(s64 a, s64 b) in drm_fixp_div() argument
140 unsigned shift = 62 - drm_fixp_msbset(a); in drm_fixp_div()
143 a <<= shift; in drm_fixp_div()
148 result = div64_s64(a, b); in drm_fixp_div()
156 static inline s64 drm_fixp_from_fraction(s64 a, s64 b) in drm_fixp_from_fraction() argument
159 bool a_neg = a < 0; in drm_fixp_from_fraction()
161 u64 a_abs = a_neg ? -a : a; in drm_fixp_from_fraction()
173 rem <<= 1; in drm_fixp_from_fraction()
174 res_abs <<= 1; in drm_fixp_from_fraction()
176 res_abs |= 1; in drm_fixp_from_fraction()
184 u64 summand = (rem << 1) >= b_abs; in drm_fixp_from_fraction()
199 u64 count = 1; in drm_fixp_exp()
202 y = -1 * x; in drm_fixp_exp()
208 count = count + 1; in drm_fixp_exp()