Added bits_val() macro, fixed problem with operator priority in macro bit().

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@162 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Marcel Telka 23 years ago
parent 9aec74699f
commit 929394b189

@ -51,11 +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 ABS(a) (((a) < 0) ? (-(a)) : (a))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define MAX(a,b) (((a) < (b)) ? (b) : (a))
#define bit(x) (1 << x)
#define bits(b1,b2) (((2 << ABS((b1) - (b2))) - 1) << MIN(b1,b2))
#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))
#endif /* COMMON_H */

Loading…
Cancel
Save