瀏覽代碼

Create BITSET/BITCLR macros

Scott Lahteine 8 年之前
父節點
當前提交
c8f76bb8aa
共有 1 個檔案被更改,包括 4 行新增3 行删除
  1. 4
    3
      Marlin/macros.h

+ 4
- 3
Marlin/macros.h 查看文件

@@ -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…
取消
儲存