diff options
| author | Thomas Martitz <kugel@rockbox.org> | 2009-08-03 01:38:58 +0000 |
|---|---|---|
| committer | Thomas Martitz <kugel@rockbox.org> | 2009-08-03 01:38:58 +0000 |
| commit | 85ece84b1c955e2304e8519eb40ad8212a32a3ba (patch) | |
| tree | 2b70dd38cfa86f04028556eaaeff383e3afc381e /apps/plugins | |
| parent | af6060a987a2ad6ecdf62eb6b13dca61d65d7318 (diff) | |
| download | rockbox-85ece84b1c955e2304e8519eb40ad8212a32a3ba.zip rockbox-85ece84b1c955e2304e8519eb40ad8212a32a3ba.tar.gz rockbox-85ece84b1c955e2304e8519eb40ad8212a32a3ba.tar.bz2 rockbox-85ece84b1c955e2304e8519eb40ad8212a32a3ba.tar.xz | |
Remove various ABS() definitions with a single one using typeof (if using gcc) to avoid multiple evaluations of the input expressions. Speex still uses its own as I didn't want to change this imported code too much.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22129 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
| -rw-r--r-- | apps/plugins/calculator.c | 1 | ||||
| -rw-r--r-- | apps/plugins/chessbox/gnuchess.c | 2 | ||||
| -rw-r--r-- | apps/plugins/invadrox.c | 5 | ||||
| -rw-r--r-- | apps/plugins/lib/buflib.c | 7 | ||||
| -rw-r--r-- | apps/plugins/spacerocks.c | 2 |
5 files changed, 1 insertions, 16 deletions
diff --git a/apps/plugins/calculator.c b/apps/plugins/calculator.c index 079a6e5..3d0105e 100644 --- a/apps/plugins/calculator.c +++ b/apps/plugins/calculator.c @@ -102,7 +102,6 @@ PLUGIN_HEADER #define X_5_POS (X_4_POS + REC_WIDTH) /* x5 = 110, column 111 left blank */ #define SIGN(x) ((x)<0?-1:1) -#define ABS(x) ((x)<0?-(x):(x)) /* variable button definitions */ #if CONFIG_KEYPAD == RECORDER_PAD diff --git a/apps/plugins/chessbox/gnuchess.c b/apps/plugins/chessbox/gnuchess.c index b8fef72..5c30c6a 100644 --- a/apps/plugins/chessbox/gnuchess.c +++ b/apps/plugins/chessbox/gnuchess.c @@ -60,7 +60,7 @@ #define maxdepth 30 #define true 1 #define false 0 -#define absv(x) ((x) < 0 ? -(x) : (x)) +#define absv(x) (ABS(x)) #define taxicab(a,b) (abs(column[a]-column[b]) + abs(row[a]-row[b])) /* ---- Chess datatypes and variables ---- */ diff --git a/apps/plugins/invadrox.c b/apps/plugins/invadrox.c index d07bf28..d424f1f 100644 --- a/apps/plugins/invadrox.c +++ b/apps/plugins/invadrox.c @@ -167,11 +167,6 @@ PLUGIN_HEADER #define UNUSED __attribute__ ((unused)) #endif -#ifndef ABS -#define ABS(x) (((x) < 0) ? (-(x)) : (x)) -#endif - - /* Defines common to all models */ #define UFO_Y (SCORENUM_Y + FONT_HEIGHT + ALIEN_HEIGHT) #define PLAYFIELD_Y (LCD_HEIGHT - SHIP_HEIGHT - 2) diff --git a/apps/plugins/lib/buflib.c b/apps/plugins/lib/buflib.c index ddfc82c..5d03ca4 100644 --- a/apps/plugins/lib/buflib.c +++ b/apps/plugins/lib/buflib.c @@ -40,13 +40,6 @@ * case that use a predefined context. */ -#define ABS(x) \ -({ \ - typeof(x) xtmp_abs_ = x; \ - xtmp_abs_ = xtmp_abs_ < 0 ? -xtmp_abs_ : xtmp_abs_; \ - xtmp_abs_; \ -}) - /* Initialize buffer manager */ void buflib_init(struct buflib_context *ctx, void *buf, size_t size) diff --git a/apps/plugins/spacerocks.c b/apps/plugins/spacerocks.c index 7ceec16..32d4886 100644 --- a/apps/plugins/spacerocks.c +++ b/apps/plugins/spacerocks.c @@ -246,8 +246,6 @@ PLUGIN_HEADER #endif #endif -#define ABS(x) ((x)>0?(x):-(x)) - #define RES MAX(LCD_WIDTH, LCD_HEIGHT) #define LARGE_LCD RES >= 200 #define ENEMY_MISSILE_SURVIVAL_LENGTH RES/2 |