mirror of
https://github.com/esphome/esphome.git
synced 2025-01-20 21:11:32 +01:00
parent
3a36d0b13f
commit
069b5f81a0
@ -38,8 +38,8 @@ void Wiegand::setup() {
|
||||
bool check_eparity(uint64_t value, int start, int length) {
|
||||
int parity = 0;
|
||||
uint64_t mask = 1LL << start;
|
||||
for (int i = 0; i <= length; i++, mask <<= 1) {
|
||||
if (value & i)
|
||||
for (int i = 0; i < length; i++, mask <<= 1) {
|
||||
if (value & mask)
|
||||
parity++;
|
||||
}
|
||||
return !(parity & 1);
|
||||
@ -48,8 +48,8 @@ bool check_eparity(uint64_t value, int start, int length) {
|
||||
bool check_oparity(uint64_t value, int start, int length) {
|
||||
int parity = 0;
|
||||
uint64_t mask = 1LL << start;
|
||||
for (int i = 0; i <= length; i++, mask <<= 1) {
|
||||
if (value & i)
|
||||
for (int i = 0; i < length; i++, mask <<= 1) {
|
||||
if (value & mask)
|
||||
parity++;
|
||||
}
|
||||
return parity & 1;
|
||||
|
Loading…
Reference in New Issue
Block a user