summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2006-07-19 17:47:06 +0000
committerDave Chapman <dave@dchapman.com>2006-07-19 17:47:06 +0000
commit61c301bf8d7606e7cd693f6b66b9657462a3a6b4 (patch)
tree512eb2b76b6a4474e3a5ac3f766ee579f0887d99
parent73c6c9d279c7f2c0e12710ad692bbfbc3a846c95 (diff)
downloadrockbox-61c301bf8d7606e7cd693f6b66b9657462a3a6b4.zip
rockbox-61c301bf8d7606e7cd693f6b66b9657462a3a6b4.tar.gz
rockbox-61c301bf8d7606e7cd693f6b66b9657462a3a6b4.tar.bz2
rockbox-61c301bf8d7606e7cd693f6b66b9657462a3a6b4.tar.xz
Patch #5432 from Thomas Paul Diffenbach - small speedup for ipod video lcd_update function.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10252 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/drivers/lcd-ipodvideo.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/firmware/drivers/lcd-ipodvideo.c b/firmware/drivers/lcd-ipodvideo.c
index 84b8303..b94ab0b 100644
--- a/firmware/drivers/lcd-ipodvideo.c
+++ b/firmware/drivers/lcd-ipodvideo.c
@@ -172,12 +172,19 @@ void lcd_update_rect(int x, int y, int width, int height)
unsigned short *end = &src[LCD_WIDTH * height];
int line_rem = (LCD_WIDTH - width);
while (src < end) {
- /* for each column */
- unsigned short *end_line = src + width;
- while (src < end_line) {
- /* write out two pixels */
- outw(*(src++), 0x30000000);
- outw(*(src++), 0x30000000);
+ /* Duff's Device to unroll loop */
+ register int count = width ;
+ register int n=( count + 7 ) / 8;
+ switch( count % 8 ) {
+ case 0: do{ outw(*(src++), 0x30000000);
+ case 7: outw(*(src++), 0x30000000);
+ case 6: outw(*(src++), 0x30000000);
+ case 5: outw(*(src++), 0x30000000);
+ case 4: outw(*(src++), 0x30000000);
+ case 3: outw(*(src++), 0x30000000);
+ case 2: outw(*(src++), 0x30000000);
+ case 1: outw(*(src++), 0x30000000);
+ } while(--n>0);
}
src += line_rem;
}