-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Description
I am working with Neopixel multistrip project with RPi Pi Pico (not important how and why, just for note).
I need to manipulate bits in uint64_t variable.
Standard bitRead(), bitWrite(0, bitSet(), bitClear(), bitToggle() macros not working. They work only up to 32 bits (uint32_t).
I made quick hack in my code to work with 64 bit variables:
#define bitRead64(value, bit) (((value) >> (bit)) & 0x01ULL)
#define bitSet64(value, bit) ((value) |= (1ULL << (bit)))
#define bitClear64(value, bit) ((value) &= ~(1ULL << (bit)))
#define bitToggle64(value, bit) ((value) ^= (1ULL << (bit)))
#define bitWrite64(value, bit, bitvalue) ((bitvalue) ? bitSet64((value), (bit)) : bitClear64((value), (bit)))
Recommendations: consider to rewrite bitRead(), bitWrite(), bitSet(0, bitClear(), bitToggle() and bit() for 64 bit compatibility if possible and hope it will not break global compatibility.
Original post: https://github.com/earlephilhower/arduino-pico/issues/3260