Merge remote-tracking branch 'origin/issue-955' into integration_2025_w31 (!3545)

Fix overflow when negating minimum int16_t value in precoding

This closes #955

It prevents undefined behavior caused by the minimum int16_t value
(-32768) in two's complement representation. Because possible negation
by multiplying with -1 during precoding cause an overflows since +32768
cannot be represented in 16-bit signed integers and end up again in
-32768 because of overflow, here reveald by using the SIMD functions.

Workaround we use a slightly smaller number than 1 in Q15 Format to
prevent this error. Q15 representation of (integer value -32767) -1 +
2^-15 = -0.999969482421875
This commit is contained in:
Robert Schmidt
2025-07-31 15:26:21 +02:00
7 changed files with 231 additions and 11 deletions
+1 -1
View File
@@ -163,7 +163,7 @@ extern "C" {
__attribute__((always_inline)) inline c16_t c16conj(const c16_t a) {
return (c16_t) {
.r = a.r,
.i = (int16_t)-a.i
.i = (int16_t)-a.i
};
}