aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-08-06 11:54:39 +0200
committerHarald Welte <laforge@osmocom.org>2020-08-06 11:58:14 +0200
commit1f310f7b035e454f38d0de3035f0be83a38efe04 (patch)
tree319e0834b7a62baea81e78ee1375af863a33f751
parentdbb429cfd303fb96cbef96767ed92ad53dd51425 (diff)
trau_frame: Fix computation of odd parity while encoding HR frames
division modulo 1 is always 0, and hence we always returned '1' as parity bit. Instead, we need to check if the LSB is set in order to know if the number of bits is odd or even. Change-Id: I37af702ba020a90a820bae84cb603e187ebbacb5 Closes: CID#211594
-rw-r--r--src/trau/trau_frame.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/trau/trau_frame.c b/src/trau/trau_frame.c
index 0a8faf9..1159bb1 100644
--- a/src/trau/trau_frame.c
+++ b/src/trau/trau_frame.c
@@ -817,7 +817,7 @@ static ubit_t compute_odd_parity(const ubit_t *in, unsigned int num_bits)
sum++;
}
- if (sum % 1)
+ if (sum & 1)
return 0;
else
return 1;