mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-21 15:09:23 +08:00
Finally process the Golay(24,12,8) parity bit.
This commit is contained in:
14
Utils.cpp
14
Utils.cpp
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2009,2014,2015,2016 Jonathan Naylor, G4KLX
|
||||
* Copyright (C) 2009,2014,2015,2016,2021 Jonathan Naylor, G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -144,3 +144,15 @@ void CUtils::bitsToByteLE(const bool* bits, unsigned char& byte)
|
||||
byte |= bits[6U] ? 0x40U : 0x00U;
|
||||
byte |= bits[7U] ? 0x80U : 0x00U;
|
||||
}
|
||||
|
||||
unsigned int CUtils::countBits(unsigned int v)
|
||||
{
|
||||
unsigned int count = 0U;
|
||||
|
||||
while (v != 0U) {
|
||||
v &= v - 1U;
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user