Rev 1123 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1123 | Rev 1321 | ||
---|---|---|---|
Line 36... | Line 36... | ||
36 | #define rfixed_mul(A, B) ((u64)((u64)(A).full * (B).full + 2048) >> 12) |
36 | #define rfixed_mul(A, B) ((u64)((u64)(A).full * (B).full + 2048) >> 12) |
37 | #define fixed_init(A) { .full = rfixed_const((A)) } |
37 | #define fixed_init(A) { .full = rfixed_const((A)) } |
38 | #define fixed_init_half(A) { .full = rfixed_const_half((A)) } |
38 | #define fixed_init_half(A) { .full = rfixed_const_half((A)) } |
39 | #define rfixed_trunc(A) ((A).full >> 12) |
39 | #define rfixed_trunc(A) ((A).full >> 12) |
Line -... | Line 40... | ||
- | 40 | ||
- | 41 | static inline u32 rfixed_floor(fixed20_12 A) |
|
- | 42 | { |
|
- | 43 | u32 non_frac = rfixed_trunc(A); |
|
- | 44 | ||
- | 45 | return rfixed_const(non_frac); |
|
- | 46 | } |
|
- | 47 | ||
- | 48 | static inline u32 rfixed_ceil(fixed20_12 A) |
|
- | 49 | { |
|
- | 50 | u32 non_frac = rfixed_trunc(A); |
|
- | 51 | ||
- | 52 | if (A.full > rfixed_const(non_frac)) |
|
- | 53 | return rfixed_const(non_frac + 1); |
|
- | 54 | else |
|
- | 55 | return rfixed_const(non_frac); |
|
- | 56 | } |
|
40 | 57 | ||
41 | static inline u32 rfixed_div(fixed20_12 A, fixed20_12 B) |
58 | static inline u32 rfixed_div(fixed20_12 A, fixed20_12 B) |
42 | { |
59 | { |
Line 43... | Line 60... | ||
43 | u64 tmp = ((u64)A.full << 13); |
60 | u64 tmp = ((u64)A.full << 13); |