mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-21 06:55:52 +08:00
First attempt at detecting D-Star data frames, Kenwood and Icom.
This commit is contained in:
19
Utils.cpp
19
Utils.cpp
@@ -144,3 +144,22 @@ void CUtils::bitsToByteLE(const bool* bits, unsigned char& byte)
|
||||
byte |= bits[6U] ? 0x40U : 0x00U;
|
||||
byte |= bits[7U] ? 0x80U : 0x00U;
|
||||
}
|
||||
|
||||
unsigned int CUtils::compare(const unsigned char* bytes1, const unsigned char* bytes2, unsigned int length)
|
||||
{
|
||||
assert(bytes1 != NULL);
|
||||
assert(bytes2 != NULL);
|
||||
|
||||
unsigned int diffs = 0U;
|
||||
|
||||
for (unsigned int i = 0U; i < length; i++) {
|
||||
unsigned char v = bytes1[i] ^ bytes2[i];
|
||||
while (v != 0U) {
|
||||
v &= v - 1U;
|
||||
diffs++;
|
||||
}
|
||||
}
|
||||
|
||||
return diffs;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user