-
-
Notifications
You must be signed in to change notification settings - Fork 141
Open
Description
I need to manipulate bits in uint64_t variable.
Standard bitRead(), bitWrite(), 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(), bitClear(), bitToggle() and bit() for 64 bit compatibility if possible and hope it will not break global compatibility.
Original post: earlephilhower/arduino-pico#3260
Metadata
Metadata
Assignees
Labels
No labels