Fix #966 USAN: implicit signed integer truncation in TCX harm model arithmetic coder
- Related issues: #966 (closed)
- Requested reviewers: @multrus @fotopoulou
Reason why this change is needed
- Fix an Undefined Behaviour bug
Description of the change
- The intermediate result of a multiplication of two 16bit values is now stored in an 32bit variable to prevent the implicit cast. The intermediate value is right-shifted afterwards so the result that is finally obtained (in a 16bit var) is always in 16bit range.
Affected operating points
- Everything that uses TCX with harmonic model, but:
- all is BE (stv and ltv)
- bitstream is not changed
Related to #966 (closed)
Edited by Jan Kiene