summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Mahone <andrew.mahone@gmail.com>2009-01-21 05:10:16 +0000
committerAndrew Mahone <andrew.mahone@gmail.com>2009-01-21 05:10:16 +0000
commit5d3fd5d5ce2e0a5fa3905b87dfcca94cbe1d57af (patch)
treeec14501f98509e68e269db8f206893402c4e8215
parent580d91f097b23aa1bb3b935bd45c1d64655e2259 (diff)
downloadrockbox-5d3fd5d5ce2e0a5fa3905b87dfcca94cbe1d57af.tar.gz
rockbox-5d3fd5d5ce2e0a5fa3905b87dfcca94cbe1d57af.tar.bz2
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.c8
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)