From 4b574992fd3cdcc5a202876243696dcc73e93169 Mon Sep 17 00:00:00 2001 From: Marcel Telka Date: Tue, 22 Oct 2002 07:09:41 +0000 Subject: [PATCH] Ported macros bits() and bits_val() to assembler. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@196 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- include/common.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/common.h b/include/common.h index 06a8b3ee..42d2612b 100644 --- a/include/common.h +++ b/include/common.h @@ -51,12 +51,12 @@ #define C 1 #endif -#define ABS(a) (((a) < 0) ? (-(a)) : (a)) -#define MIN(a,b) (((a) < (b)) ? (a) : (b)) -#define MAX(a,b) (((a) < (b)) ? (b) : (a)) +#define MAX_BITS_ABS_VAL 1024 +#define BITS_ABS(a) (((((a) + MAX_BITS_ABS_VAL) / MAX_BITS_ABS_VAL) * 2 - 1) * (a)) +#define BITS_MIN(a,b) (((a) + (b) - BITS_ABS((a) - (b))) / 2) #define bit(b) (1 << (b)) -#define bits(b1,b2) (((2 << ABS((b1) - (b2))) - 1) << MIN(b1,b2)) -#define bits_val(b1,b2,v) (((v) << MIN(b1,b2)) & bits(b1,b2)) +#define bits(b1,b2) (((2 << BITS_ABS((b1) - (b2))) - 1) << BITS_MIN(b1,b2)) +#define bits_val(b1,b2,v) (((v) << BITS_MIN(b1,b2)) & bits(b1,b2)) #endif /* COMMON_H */