diff options
author | Andrew Mahone <andrew.mahone@gmail.com> | 2009-01-21 05:10:16 +0000 |
---|---|---|
committer | Andrew Mahone <andrew.mahone@gmail.com> | 2009-01-21 05:10:16 +0000 |
commit | 5d3fd5d5ce2e0a5fa3905b87dfcca94cbe1d57af (patch) | |
tree | ec14501f98509e68e269db8f206893402c4e8215 | |
parent | 580d91f097b23aa1bb3b935bd45c1d64655e2259 (diff) | |
download | rockbox-5d3fd5d5ce2e0a5fa3905b87dfcca94cbe1d57af.tar.gz rockbox-5d3fd5d5ce2e0a5fa3905b87dfcca94cbe1d57af.zip |
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
-rw-r--r-- | apps/plugins/pictureflow.c | 8 |
1 files 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) |