From 5d3fd5d5ce2e0a5fa3905b87dfcca94cbe1d57af Mon Sep 17 00:00:00 2001 From: Andrew Mahone Date: Wed, 21 Jan 2009 05:10:16 +0000 Subject: [PATCH] replace DIV255 with an inline function, the macro version caused unneeded recalculations git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19809 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/pictureflow.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/plugins/pictureflow.c b/apps/plugins/pictureflow.c index 1190de1e27..344f6ff5e0 100644 --- a/apps/plugins/pictureflow.c +++ b/apps/plugins/pictureflow.c @@ -397,8 +397,12 @@ static inline PFreal fcos(int iangle) return fsin(iangle + (IANGLE_MAX >> 2)); } -#define DIV255(val) ((((((val)>>8)+(val))>>8)+(val))>>8) -#define SCALE_VAL(val,out) DIV255((val) * (out) + 127) +static inline uint32_t div255(uint32_t val) +{ + return ((((val >> 8) + val) >> 8) + val) >> 8; +} + +#define SCALE_VAL(val,out) div255((val) * (out) + 127) static void output_row_transposed(uint32_t row, void * row_in, struct scaler_context *ctx)