mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-12 10:20:32 +00:00
Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into next
This commit is contained in:
commit
fa4eb25920
@ -72,8 +72,8 @@ u8 parity(u32 x)
|
||||
u32 getbitu(const u8 *buff, u32 pos, u8 len)
|
||||
{
|
||||
u32 bits = 0;
|
||||
|
||||
for (u32 i = pos; i < pos + len; i++) {
|
||||
u32 i=0;
|
||||
for ( i= pos; i < pos + len; i++) {
|
||||
bits = (bits << 1) +
|
||||
((buff[i/8] >> (7 - i%8)) & 1u);
|
||||
}
|
||||
@ -117,9 +117,9 @@ void setbitu(u8 *buff, u32 pos, u32 len, u32 data)
|
||||
u32 mask = 1u << (len - 1);
|
||||
|
||||
if (len <= 0 || 32 < len)
|
||||
return;
|
||||
|
||||
for (u32 i = pos; i < pos + len; i++, mask >>= 1) {
|
||||
return;
|
||||
u32 i=0;
|
||||
for (i = pos; i < pos + len; i++, mask >>= 1) {
|
||||
if (data & mask)
|
||||
buff[i/8] |= 1u << (7 - i % 8);
|
||||
else
|
||||
@ -175,7 +175,8 @@ void bitshl(void *buf, u32 size, u32 shift)
|
||||
} else {
|
||||
/* Create an accumulator: it will hold a value of two consecutive bytes */
|
||||
u32 acc = *src++;
|
||||
for (u32 i = 0; i < full_bytes; ++i) {
|
||||
u32 i=0;
|
||||
for (i = 0; i < full_bytes; ++i) {
|
||||
acc = (acc << CHAR_BIT) | *src++;
|
||||
*dst++ = acc >> byte_shift;
|
||||
}
|
||||
@ -207,8 +208,8 @@ void bitcopy(void *dst, u32 dst_index, const void *src, u32 src_index,
|
||||
{
|
||||
u32 limit1 = count / 32;
|
||||
u32 limit2 = count % 32;
|
||||
|
||||
for (u32 idx = 0; idx < limit1; ++idx) {
|
||||
u32 idx=0;
|
||||
for (idx = 0; idx < limit1; ++idx) {
|
||||
u32 tmp = getbitu(src, src_index, 32);
|
||||
setbitu(dst, dst_index, 32, tmp);
|
||||
src_index += 32;
|
||||
@ -231,7 +232,8 @@ void bitcopy(void *dst, u32 dst_index, const void *src, u32 src_index,
|
||||
u8 count_bits_u64(u64 v, u8 bv)
|
||||
{
|
||||
u8 r = 0;
|
||||
for (int i = 0; i < 16; i++)
|
||||
int i =0;
|
||||
for (i = 0; i < 16; i++)
|
||||
r += bitn[(v >> (i*4)) & 0xf];
|
||||
return bv == 1 ? r : 64 - r;
|
||||
}
|
||||
@ -247,7 +249,8 @@ u8 count_bits_u64(u64 v, u8 bv)
|
||||
u8 count_bits_u32(u32 v, u8 bv)
|
||||
{
|
||||
u8 r = 0;
|
||||
for (int i = 0; i < 8; i++)
|
||||
int i=0;
|
||||
for (i = 0; i < 8; i++)
|
||||
r += bitn[(v >> (i*4)) & 0xf];
|
||||
return bv == 1 ? r : 32 - r;
|
||||
}
|
||||
@ -263,7 +266,8 @@ u8 count_bits_u32(u32 v, u8 bv)
|
||||
u8 count_bits_u16(u16 v, u8 bv)
|
||||
{
|
||||
u8 r = 0;
|
||||
for (int i = 0; i < 4; i++)
|
||||
int i =0;
|
||||
for (i= 0; i < 4; i++)
|
||||
r += bitn[(v >> (i*4)) & 0xf];
|
||||
return bv == 1 ? r : 16 - r;
|
||||
}
|
||||
@ -279,7 +283,8 @@ u8 count_bits_u16(u16 v, u8 bv)
|
||||
u8 count_bits_u8(u8 v, u8 bv)
|
||||
{
|
||||
u8 r = 0;
|
||||
for (int i = 0; i < 2; i++)
|
||||
int i=0;
|
||||
for (i = 0; i < 2; i++)
|
||||
r += bitn[(v >> (i*4)) & 0xf];
|
||||
return bv == 1 ? r : 8 - r;
|
||||
}
|
||||
|
@ -129,7 +129,9 @@ static void _cnav_rescan_preamble(cnav_v27_part_t *part)
|
||||
part->preamble_seen = false;
|
||||
|
||||
if (part->n_decoded > GPS_CNAV_PREAMBLE_LENGTH + 1) {
|
||||
for (size_t i = 1, j = part->n_decoded - GPS_CNAV_PREAMBLE_LENGTH;
|
||||
size_t i=0;
|
||||
size_t j=0;
|
||||
for (i = 1, j = part->n_decoded - GPS_CNAV_PREAMBLE_LENGTH;
|
||||
i < j; ++i) {
|
||||
u32 c = getbitu(part->decoded, i, GPS_CNAV_PREAMBLE_LENGTH);
|
||||
if (GPS_CNAV_PREAMBLE1 == c || GPS_CNAV_PREAMBLE2 == c) {
|
||||
@ -280,7 +282,8 @@ static void _cnav_add_symbol(cnav_v27_part_t *part, u8 ch)
|
||||
*/
|
||||
static void _cnav_msg_invert(cnav_v27_part_t *part)
|
||||
{
|
||||
for (size_t i = 0; i < sizeof(part->decoded); i++) {
|
||||
size_t i = 0;
|
||||
for (i = 0; i < sizeof(part->decoded); i++) {
|
||||
part->decoded[i] ^= 0xFFu;
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,8 @@ static const u32 crc24qtab[256] = {
|
||||
*/
|
||||
u32 crc24q(const u8 *buf, u32 len, u32 crc)
|
||||
{
|
||||
for (u32 i = 0; i < len; i++)
|
||||
u32 i=0;
|
||||
for ( i= 0; i < len; i++)
|
||||
crc = ((crc << 8) & 0xFFFFFF) ^ crc24qtab[((crc >> 16) ^ buf[i]) & 0xff];
|
||||
return crc;
|
||||
}
|
||||
@ -117,7 +118,8 @@ u32 crc24q_bits(u32 crc, const u8 *buf, u32 n_bits, bool invert)
|
||||
u8 b = 0;
|
||||
u32 shift = 8 - n_bits % 8;
|
||||
|
||||
for (u32 i = 0; i < n_bits / 8; ++i) {
|
||||
u32 i=0;
|
||||
for ( i= 0; i < n_bits / 8; ++i) {
|
||||
acc = (acc << 8) | *buf++;
|
||||
if (invert) {
|
||||
acc ^= 0xFFu;
|
||||
|
Loading…
Reference in New Issue
Block a user