From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Reding Subject: [RFC v2 4/5] drm: fixed: Add dfixed_frac Date: Wed, 25 Apr 2012 11:45:01 +0200 Message-ID: <1335347102-14905-5-git-send-email-thierry.reding@avionic-design.de> References: <1335347102-14905-1-git-send-email-thierry.reding@avionic-design.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1335347102-14905-1-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Cc: =?UTF-8?q?Terje=20Bergstr=C3=B6m?= , Stephen Warren , David Airlie , devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org, Mark Brown , Robert Morell , dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, Wolfram Sang , Grant Likely , Jon Mayo , iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Rob Herring , Ben Dooks , Colin Cross , Olof Johansson , Olof Johansson , Liam Girdwood List-Id: dri-devel@lists.freedesktop.org From: Robert Morell This helper macro retrieves the fractional part of a fixed20_12 20.12 fixed-point number. Signed-off-by: Robert Morell Signed-off-by: Olof Johansson Signed-off-by: Thierry Reding --- include/drm/drm_fixed.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/drm/drm_fixed.h b/include/drm/drm_fixed.h index 4a08a66..0ead502 100644 --- a/include/drm/drm_fixed.h +++ b/include/drm/drm_fixed.h @@ -37,6 +37,7 @@ typedef union dfixed { #define dfixed_init(A) { .full = dfixed_const((A)) } #define dfixed_init_half(A) { .full = dfixed_const_half((A)) } #define dfixed_trunc(A) ((A).full >> 12) +#define dfixed_frac(A) ((A).full & ((1 << 12) - 1)) static inline u32 dfixed_floor(fixed20_12 A) { -- 1.7.10