Browse Source

Create BITSET/BITCLR macros

Scott Lahteine 8 years ago
parent
commit
c8f76bb8aa
1 changed files with 4 additions and 3 deletions
  1. 4
    3
      Marlin/macros.h

+ 4
- 3
Marlin/macros.h View File

@@ -2,9 +2,10 @@
2 2
 #define MACROS_H
3 3
 
4 4
 // Macros for bit masks
5
-#define BIT(b) (1<<(b))
6
-#define TEST(n,b) (((n)&BIT(b))!=0)
7
-#define SET_BIT(n,b,value) (n) ^= ((-value)^(n)) & (BIT(b))
5
+#define TEST(n,b) (((n)&_BV(b))!=0)
6
+#define SBI(n,b) (n |= _BV(b))
7
+#define CBI(n,b) (n &= ~_BV(b))
8
+#define SET_BIT(n,b,value) (n) ^= ((-value)^(n)) & (_BV(b))
8 9
 
9 10
 // Macros for maths shortcuts
10 11
 #define RADIANS(d) ((d)*M_PI/180.0)

Loading…
Cancel
Save