diff options
author | Jens Arnold <amiconn@rockbox.org> | 2006-08-04 07:02:34 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2006-08-04 07:02:34 +0000 |
commit | f212e6cf5fb6327b51abdf1af2b102f87c896a32 (patch) | |
tree | 991e6e6704a53c9b51177f4e2205aa28d7931a35 /apps/plugins/lib | |
parent | 737e4768a1783c03b2dc2fb29eba43d4b76350bb (diff) | |
download | rockbox-f212e6cf5fb6327b51abdf1af2b102f87c896a32.tar.gz rockbox-f212e6cf5fb6327b51abdf1af2b102f87c896a32.zip |
Smaller & faster (on our targets) fixed point exp() with a multiplication.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10454 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/lib')
-rw-r--r-- | apps/plugins/lib/gray_core.c | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/apps/plugins/lib/gray_core.c b/apps/plugins/lib/gray_core.c index 2b4d2c5eb7..5f565218ff 100644 --- a/apps/plugins/lib/gray_core.c +++ b/apps/plugins/lib/gray_core.c | |||
@@ -226,15 +226,7 @@ static int exp_s16p16(int x) | |||
226 | t = x - 0x007e1; if (t >= 0) x = t, y += y >> 5; | 226 | t = x - 0x007e1; if (t >= 0) x = t, y += y >> 5; |
227 | t = x - 0x003f8; if (t >= 0) x = t, y += y >> 6; | 227 | t = x - 0x003f8; if (t >= 0) x = t, y += y >> 6; |
228 | t = x - 0x001fe; if (t >= 0) x = t, y += y >> 7; | 228 | t = x - 0x001fe; if (t >= 0) x = t, y += y >> 7; |
229 | if (x & 0x100) y += y >> 8; | 229 | y += ((y >> 8) * x) >> 8; |
230 | if (x & 0x080) y += y >> 9; | ||
231 | if (x & 0x040) y += y >> 10; | ||
232 | if (x & 0x020) y += y >> 11; | ||
233 | if (x & 0x010) y += y >> 12; | ||
234 | if (x & 0x008) y += y >> 13; | ||
235 | if (x & 0x004) y += y >> 14; | ||
236 | if (x & 0x002) y += y >> 15; | ||
237 | if (x & 0x001) y += y >> 16; | ||
238 | 230 | ||
239 | return y; | 231 | return y; |
240 | } | 232 | } |