Browse Source

Use _BV32 to avoid name conflict

Scott Lahteine 6 years ago
parent
commit
f5cfdf6efe

+ 2
- 2
Marlin/src/HAL/HAL_LPC1768/WInterrupts.cpp View File

@@ -130,8 +130,8 @@ extern "C" void GpioDisableInt(const uint32_t port, const uint32_t pin) {
130 130
   }
131 131
 }
132 132
 
133
-bool isPowerOf2(unsigned int n) {
134
-  return n == 1 || (n & (n - 1)) == 0;
133
+constexpr bool isPowerOf2(const uint16_t n) {
134
+  return IS_POWER_OF_2(n);
135 135
 }
136 136
 
137 137
 #if 0

+ 1
- 1
Marlin/src/HAL/HAL_STM32F7/HAL_STM32F7.h View File

@@ -98,7 +98,7 @@
98 98
   #define NUM_SERIAL 1
99 99
 #endif
100 100
 
101
-#define _BV(b) (1UL << (b))
101
+#define _BV(b) (1 << (b))
102 102
 
103 103
 /**
104 104
  * TODO: review this to return 1 for pins that are not analog input

+ 1
- 1
Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h View File

@@ -29,7 +29,7 @@
29 29
 #ifndef _FASTIO_STM32F7_H
30 30
 #define _FASTIO_STM32F7_H
31 31
 
32
-#define _BV(b) (1UL << (b))
32
+#define _BV(b) (1 << (b))
33 33
 
34 34
 #define READ(IO)              digitalRead(IO)
35 35
 #define WRITE(IO, v)          digitalWrite(IO,v)

+ 8
- 3
Marlin/src/core/macros.h View File

@@ -95,13 +95,18 @@
95 95
 #define STRINGIFY(M) STRINGIFY_(M)
96 96
 
97 97
 // Macros for bit masks
98
-#undef _BV // Marlin needs 32-bit unsigned!
99
-#define _BV(b) (1UL << (b))
100
-#define TEST(n,b) (((n)&_BV(b))!=0)
98
+#undef _BV
99
+#define _BV(b) (1<<(b))
100
+#define TEST(n,b) !!((n)&_BV(b))
101 101
 #define SBI(n,b) (n |= _BV(b))
102 102
 #define CBI(n,b) (n &= ~_BV(b))
103 103
 #define SET_BIT(n,b,value) (n) ^= ((-value)^(n)) & (_BV(b))
104 104
 
105
+#define _BV32(b) (1UL << (b))
106
+#define TEST32(n,b) !!((n)&_BV32(b))
107
+#define SBI32(n,b) (n |= _BV32(b))
108
+#define CBI32(n,b) (n &= ~_BV32(b))
109
+
105 110
 // Macros for maths shortcuts
106 111
 #ifndef M_PI
107 112
   #define M_PI 3.14159265358979323846

+ 3
- 3
Marlin/src/gcode/parser.h View File

@@ -108,7 +108,7 @@ public:
108 108
     static void set(const char c, char * const ptr) {
109 109
       const uint8_t ind = LETTER_BIT(c);
110 110
       if (ind >= COUNT(param)) return;           // Only A-Z
111
-      SBI(codebits, ind);                        // parameter exists
111
+      SBI32(codebits, ind);                      // parameter exists
112 112
       param[ind] = ptr ? ptr - command_ptr : 0;  // parameter offset or 0
113 113
       #if ENABLED(DEBUG_GCODE_PARSER)
114 114
         if (codenum == 800) {
@@ -125,7 +125,7 @@ public:
125 125
     static bool seen(const char c) {
126 126
       const uint8_t ind = LETTER_BIT(c);
127 127
       if (ind >= COUNT(param)) return false; // Only A-Z
128
-      const bool b = TEST(codebits, ind);
128
+      const bool b = TEST32(codebits, ind);
129 129
       if (b) {
130 130
         char * const ptr = command_ptr + param[ind];
131 131
         value_ptr = param[ind] && valid_float(ptr) ? ptr : (char*)NULL;
@@ -135,7 +135,7 @@ public:
135 135
 
136 136
     static bool seen_any() { return !!codebits; }
137 137
 
138
-    #define SEEN_TEST(L) TEST(codebits, LETTER_BIT(L))
138
+    #define SEEN_TEST(L) TEST32(codebits, LETTER_BIT(L))
139 139
 
140 140
   #else // !FASTER_GCODE_PARSER
141 141
 

Loading…
Cancel
Save