From 32c69452d699ce4dbf35e843b2f69507321e1b71 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Sun, 5 Nov 2006 14:40:14 +0000 Subject: Grayscale lib: Using a 32x32->32 bit multiplication is better on ARM, as 16x16->32 bit isn't a single instruction. Renamed the macro for pointing out that it's not necessarily 16 bit anymore, and to avoid collisions with similar macros in plugins. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11436 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/lib/gray.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'apps/plugins/lib/gray.h') diff --git a/apps/plugins/lib/gray.h b/apps/plugins/lib/gray.h index 460aa83a82..70808945bb 100644 --- a/apps/plugins/lib/gray.h +++ b/apps/plugins/lib/gray.h @@ -113,9 +113,13 @@ void gray_ub_scroll_down(int count); #define _GRAY_RUNNING 0x0001 /* greyscale overlay is running */ #define _GRAY_DEFERRED_UPDATE 0x0002 /* lcd_update() requested */ -/* unsigned 16 bit multiplication (a single instruction on the SH) */ -#define MULU16(a, b) ((unsigned long) \ - (((unsigned short) (a)) * ((unsigned short) (b)))) +/* fast unsigned multiplication (16x16bit->32bit or 32x32bit->32bit, + * whichever is faster for the architecture) */ +#ifdef CPU_ARM +#define _GRAY_MULUQ(a, b) ((uint32_t) (((uint32_t) (a)) * ((uint32_t) (b)))) +#else +#define _GRAY_MULUQ(a, b) ((uint32_t) (((uint16_t) (a)) * ((uint16_t) (b)))) +#endif /* The grayscale buffer management structure */ struct _gray_info -- cgit v1.2.3