mirror of https://github.com/thesofproject/sof.git
Math: FFT: Fix possible right shift by negative
Cppcheck found this issue: src/include/sof/math/fft.h:133:51: error: Shifting by a negative value is undefined behaviour [shiftNegative] output->real = sat_int16((((int32_t)input->real >> n_rnd) + 1) >> 1); ^ The case n == 0 need to be handled with the upper if branch non-rounded shift version. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This commit is contained in:
parent
b4c09d769e
commit
40166c699b
|
@ -125,7 +125,7 @@ static inline void icomplex16_shift(struct icomplex16 *input, int16_t n, struct
|
|||
{
|
||||
int n_rnd = -n - 1;
|
||||
|
||||
if (n > 0) {
|
||||
if (n >= 0) {
|
||||
/* need saturation handling */
|
||||
output->real = sat_int16((int32_t)input->real << n);
|
||||
output->imag = sat_int16((int32_t)input->imag << n);
|
||||
|
|
Loading…
Reference in New Issue