Browse Source

Create BITSET/BITCLR macros

pull/1/head
Scott Lahteine 9 years ago
parent
commit
c8f76bb8aa
  1. 7
      Marlin/macros.h

7
Marlin/macros.h

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

Loading…
Cancel
Save