diff options
author | Jens Arnold <amiconn@rockbox.org> | 2009-06-07 21:27:05 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2009-06-07 21:27:05 +0000 |
commit | 1d6df54df27cb41c02226678a2c8f9feddd1a1e0 (patch) | |
tree | 5fdc6dd98ac0208f5c3351b062063af6914cbefb /apps/plugins/lib/fixedpoint.c | |
parent | c3182ec333982e961d3babfbdb1125fd5bac7fb8 (diff) | |
download | rockbox-1d6df54df27cb41c02226678a2c8f9feddd1a1e0.tar.gz rockbox-1d6df54df27cb41c02226678a2c8f9feddd1a1e0.zip |
Convert a number of places in core and plugins to use the BIT_N() macro instead of 1<<n. Speeds up things on SH1, and also reduces core binsize. Most notable speedups: 1 bit lcd driver: drawpixel +20%, drawline + 27%, hline +5%; jpeg viewer: +8% for 1/8 scaling. Other targets are unaffected.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21205 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/lib/fixedpoint.c')
-rw-r--r-- | apps/plugins/lib/fixedpoint.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/apps/plugins/lib/fixedpoint.c b/apps/plugins/lib/fixedpoint.c index 7b9b68a1e8..0ae2cded69 100644 --- a/apps/plugins/lib/fixedpoint.c +++ b/apps/plugins/lib/fixedpoint.c | |||
@@ -22,6 +22,7 @@ | |||
22 | ****************************************************************************/ | 22 | ****************************************************************************/ |
23 | 23 | ||
24 | #include <inttypes.h> | 24 | #include <inttypes.h> |
25 | #include "plugin.h" | ||
25 | #include "fixedpoint.h" | 26 | #include "fixedpoint.h" |
26 | 27 | ||
27 | /* Inverse gain of circular cordic rotation in s0.31 format. */ | 28 | /* Inverse gain of circular cordic rotation in s0.31 format. */ |
@@ -144,7 +145,7 @@ long fsincos(unsigned long phase, long *cos) | |||
144 | */ | 145 | */ |
145 | long fsqrt(long a, unsigned int fracbits) | 146 | long fsqrt(long a, unsigned int fracbits) |
146 | { | 147 | { |
147 | long b = a/2 + (1 << fracbits); /* initial approximation */ | 148 | long b = a/2 + BIT_N(fracbits); /* initial approximation */ |
148 | unsigned n; | 149 | unsigned n; |
149 | const unsigned iterations = 4; | 150 | const unsigned iterations = 4; |
150 | 151 | ||