Use _BV32 to avoid name conflict

This commit is contained in:
Scott Lahteine 2018-02-01 00:06:44 -06:00
parent 6339b506c0
commit f5cfdf6efe
5 changed files with 15 additions and 10 deletions

View File

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

View File

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

View File

@ -29,7 +29,7 @@
#ifndef _FASTIO_STM32F7_H
#define _FASTIO_STM32F7_H
#define _BV(b) (1UL << (b))
#define _BV(b) (1 << (b))
#define READ(IO) digitalRead(IO)
#define WRITE(IO, v) digitalWrite(IO,v)

View File

@ -95,13 +95,18 @@
#define STRINGIFY(M) STRINGIFY_(M)
// Macros for bit masks
#undef _BV // Marlin needs 32-bit unsigned!
#define _BV(b) (1UL << (b))
#define TEST(n,b) (((n)&_BV(b))!=0)
#undef _BV
#define _BV(b) (1<<(b))
#define TEST(n,b) !!((n)&_BV(b))
#define SBI(n,b) (n |= _BV(b))
#define CBI(n,b) (n &= ~_BV(b))
#define SET_BIT(n,b,value) (n) ^= ((-value)^(n)) & (_BV(b))
#define _BV32(b) (1UL << (b))
#define TEST32(n,b) !!((n)&_BV32(b))
#define SBI32(n,b) (n |= _BV32(b))
#define CBI32(n,b) (n &= ~_BV32(b))
// Macros for maths shortcuts
#ifndef M_PI
#define M_PI 3.14159265358979323846

View File

@ -108,7 +108,7 @@ public:
static void set(const char c, char * const ptr) {
const uint8_t ind = LETTER_BIT(c);
if (ind >= COUNT(param)) return; // Only A-Z
SBI(codebits, ind); // parameter exists
SBI32(codebits, ind); // parameter exists
param[ind] = ptr ? ptr - command_ptr : 0; // parameter offset or 0
#if ENABLED(DEBUG_GCODE_PARSER)
if (codenum == 800) {
@ -125,7 +125,7 @@ public:
static bool seen(const char c) {
const uint8_t ind = LETTER_BIT(c);
if (ind >= COUNT(param)) return false; // Only A-Z
const bool b = TEST(codebits, ind);
const bool b = TEST32(codebits, ind);
if (b) {
char * const ptr = command_ptr + param[ind];
value_ptr = param[ind] && valid_float(ptr) ? ptr : (char*)NULL;
@ -135,7 +135,7 @@ public:
static bool seen_any() { return !!codebits; }
#define SEEN_TEST(L) TEST(codebits, LETTER_BIT(L))
#define SEEN_TEST(L) TEST32(codebits, LETTER_BIT(L))
#else // !FASTER_GCODE_PARSER