1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-27 13:56:24 +00:00

Create BITSET/BITCLR macros

This commit is contained in:
Scott Lahteine 2016-02-28 23:29:53 -08:00
parent adc25db8c4
commit c8f76bb8aa

View File

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