arduino / arduino/ArduinoCore-API
Bit manipulation not working with 64 bit values
- Lenguaje dominante
- C++
- Estrellas
- 306
- Forks
- 150
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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:
```cpp
#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: https://github.com/earlephilhower/arduino-pico/issues/3260
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Comienza localizando las macros estándar bitRead(), bitWrite(), bitSet(), bitClear(), bitToggle() y bit() en la API de Arduino. Compara su comportamiento con los ejemplos de uint64_t del issue e inspecciona el pull request #278 enlazado. Se considera completado cuando se admitan valores de 64 bits sin romper la compatibilidad existente.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- cpp
- Área
- api, embedded-iot
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 25/100