summaryrefslogtreecommitdiffstats
path: root/src/conv.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/conv.c')
-rw-r--r--src/conv.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/conv.c b/src/conv.c
index 00a5532d..7a8be8ca 100644
--- a/src/conv.c
+++ b/src/conv.c
@@ -310,9 +310,12 @@ osmo_conv_decode_scan(struct osmo_conv_decoder *decoder,
m = 1 << (code->N - 1); /* mask for 'out' bit selection */
for (j=0; j<code->N; j++) {
- ov = (out & m) ? -127 : 127; /* sbit_t value for it */
- e = ((int)in_sym[j]) - ov; /* raw error for this bit */
- nae += (e * e) >> 9; /* acc the squared/scaled value */
+ int is = (int)in_sym[j];
+ if (is) {
+ ov = (out & m) ? -127 : 127; /* sbit_t value for it */
+ e = is - ov; /* raw error for this bit */
+ nae += (e * e) >> 9; /* acc the squared/scaled value */
+ }
m >>= 1; /* next mask bit */
}