When compiling CMSIS-DSP using GCC 10.3, the compiler produces the following warning in arm_divide_q15():
[build] Source/FastMathFunctions/arm_divide_q15.c: In function 'arm_divide_q15':
[build] Source/FastMathFunctions/arm_divide_q15.c:77:21: error: overflow in conversion from 'int' to 'q15_t' {aka 'short int'} changes value from '32768' to '-32768' [-Werror=overflow]
[build] 77 | *quotient = 0x8000;
[build] | ^~~~~~
0x8000 represents the positive integer 32768, but what was actually intended by the writer is the two's complement representation of -32768. Replacing 0x8000 with -32768 resolves the compiler warning and avoids further ambiguity.
When compiling CMSIS-DSP using GCC 10.3, the compiler produces the following warning in
arm_divide_q15()
:0x8000
represents the positive integer32768
, but what was actually intended by the writer is the two's complement representation of-32768
. Replacing0x8000
with-32768
resolves the compiler warning and avoids further ambiguity.