summaryrefslogtreecommitdiff
path: root/apps/plugins/rockboy/cpu.c
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2009-06-07 21:27:05 +0000
committerJens Arnold <amiconn@rockbox.org>2009-06-07 21:27:05 +0000
commit1d6df54df27cb41c02226678a2c8f9feddd1a1e0 (patch)
tree5fdc6dd98ac0208f5c3351b062063af6914cbefb /apps/plugins/rockboy/cpu.c
parentc3182ec333982e961d3babfbdb1125fd5bac7fb8 (diff)
downloadrockbox-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/rockboy/cpu.c')
-rw-r--r--apps/plugins/rockboy/cpu.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/apps/plugins/rockboy/cpu.c b/apps/plugins/rockboy/cpu.c
index 1aca06f337..2fc7411411 100644
--- a/apps/plugins/rockboy/cpu.c
+++ b/apps/plugins/rockboy/cpu.c
@@ -147,9 +147,9 @@ F = (F & (FN)) | ZFLAG(A) | daa_carry_table[LB(acc)>>2]; }
147(r) = swap_table[(r)]; \ 147(r) = swap_table[(r)]; \
148F = ZFLAG((r)); } 148F = ZFLAG((r)); }
149 149
150#define BIT(n,r) { F = (F & FC) | ZFLAG(((r) & (1 << (n)))) | FH; } 150#define BIT(n,r) { F = (F & FC) | ZFLAG(((r) & BIT_N(n))) | FH; }
151#define RES(n,r) { (r) &= ~(1 << (n)); } 151#define RES(n,r) { (r) &= ~BIT_N(n); }
152#define SET(n,r) { (r) |= (1 << (n)); } 152#define SET(n,r) { (r) |= BIT_N(n); }
153 153
154#define CB_REG_CASES(r, n) \ 154#define CB_REG_CASES(r, n) \
155case 0x00|(n): RLC(r); break; \ 155case 0x00|(n): RLC(r); break; \
@@ -225,7 +225,7 @@ label: op(b); break;
225 225
226 226
227#define PRE_INT ( DI, PUSH(PC) ) 227#define PRE_INT ( DI, PUSH(PC) )
228#define THROW_INT(n) ( (IF &= ~(1<<(n))), (PC = 0x40+((n)<<3)) ) 228#define THROW_INT(n) ( (IF &= ~BIT_N(n)), (PC = 0x40+((n)<<3)) )
229 229
230#ifdef DYNAREC 230#ifdef DYNAREC
231un32 reg_backup[16]; 231un32 reg_backup[16];
@@ -355,7 +355,7 @@ static int cpu_idle(int max)
355 355
356 /* Figure out when the next timer interrupt will happen */ 356 /* Figure out when the next timer interrupt will happen */
357 unit = ((-R_TAC) & 3) << 1; 357 unit = ((-R_TAC) & 3) << 1;
358 cnt = (511 - cpu.tim + (1<<unit)) >> unit; 358 cnt = (511 - cpu.tim + BIT_N(unit)) >> unit;
359 cnt += (255 - R_TIMA) << (9 - unit); 359 cnt += (255 - R_TIMA) << (9 - unit);
360 360
361 if (max < cnt) 361 if (max < cnt)