Fix an assert in ViterbiR2O4::decode

The table length was wrong becuase matchCostTable is a float pointer and
not an array since 792330777d

python2.7: /home/user/gr-gsm/lib/decoding/openbts/ViterbiR204.cpp:288: virtual void ViterbiR2O4::decode(const SoftVector&, BitVector&): Assertion `match-matchCostTable<(float)sizeof(matchCostTable)/sizeof(matchCostTable[0])-1' failed.

 (gdb) f 4
 #4  0x00007fffdff820c3 in ViterbiR2O4::decode (this=0x5555563bbdf0, in=..., target=...)
     at /home/vasko/sources/gr-gsm/gr-gsm/lib/decoding/openbts/ViterbiR204.cpp:288
 288				assert(match-matchCostTable<(float)sizeof(matchCostTable)/sizeof(matchCostTable[0])-1);
 (gdb) p match-matchCostTable
 $1 = 2
 (gdb) p (float)sizeof(matchCostTable)/sizeof(matchCostTable[0])-1
 $2 = 1
 (gdb) p (float)sizeof(matchCostTable)/sizeof(matchCostTable[0])
 $3 = 2
 (gdb) p sizeof(matchCostTable)
 $4 = 8
This commit is contained in:
Vasil Velichkov 2018-03-27 21:08:00 +03:00 committed by Piotr Krysik
parent a396100294
commit 924d1873da
1 changed files with 2 additions and 2 deletions

View File

@ -285,8 +285,8 @@ void ViterbiR2O4::decode(const SoftVector &in, BitVector& target)
const ViterbiR2O4::vCand *minCost = NULL;
while (op<opt) {
// Viterbi algorithm
assert(match-matchCostTable<(float)sizeof(matchCostTable)/sizeof(matchCostTable[0])-1);
assert(mismatch-mismatchCostTable<(float)sizeof(mismatchCostTable)/sizeof(mismatchCostTable[0])-1);
assert(match - matchCostTable < ctsz - 1);
assert(mismatch - mismatchCostTable < ctsz - 1);
minCost = decoder.vstep(*ip, match, mismatch, oCount < oSize);
ip += step;
match += step;