提交 f7f6c340 编写于 作者: R Robert Morell 提交者: Dave Airlie

drm: fixed: Add dfixed_frac

This helper macro retrieves the fractional part of a fixed20_12 20.12
fixed-point number.
Signed-off-by: NRobert Morell <rmorell@nvidia.com>
Signed-off-by: NOlof Johansson <olofj@chromium.org>
Signed-off-by: NThierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: NDave Airlie <airlied@redhat.com>
上级 398b4706
...@@ -37,6 +37,7 @@ typedef union dfixed { ...@@ -37,6 +37,7 @@ typedef union dfixed {
#define dfixed_init(A) { .full = dfixed_const((A)) } #define dfixed_init(A) { .full = dfixed_const((A)) }
#define dfixed_init_half(A) { .full = dfixed_const_half((A)) } #define dfixed_init_half(A) { .full = dfixed_const_half((A)) }
#define dfixed_trunc(A) ((A).full >> 12) #define dfixed_trunc(A) ((A).full >> 12)
#define dfixed_frac(A) ((A).full & ((1 << 12) - 1))
static inline u32 dfixed_floor(fixed20_12 A) static inline u32 dfixed_floor(fixed20_12 A)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册