summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2011-11-24 16:04:58 +0100
committerSylvain Munaut <tnt@246tNt.com>2011-11-24 16:04:58 +0100
commitd4440d4cfab0e8ca855b3120ab92535f5df96330 (patch)
tree07a403882ab6b84b315402bfe3eec35646c52b2f /src
parent03d2c8906b99318b7a9ca2d967f5354cabbf69bd (diff)
core/conv: Really only consider error for non-zero soft values
This should have been done with 1dd7c84733b20ba776510369e9daba1a822c5b44 but somehow was missed and only applied to the 'finish' method and not the 'scan' method. Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'src')
-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 */
}