libFLAC/fixed.c: Fix undefined behaviour
authorErik de Castro Lopo <erikd@mega-nerd.com>
Fri, 28 Aug 2015 19:21:43 +0000 (05:21 +1000)
committerErik de Castro Lopo <erikd@mega-nerd.com>
Fri, 28 Aug 2015 19:22:22 +0000 (05:22 +1000)
commit1b8af6bb45a9ad74fa374fb6414974e63ffc793b
treefe7975c834a21e5a2cd970a477f97713b91dc8a1
parent25d387377a0dcb5b2fd2aafab09bdd9c8b1e3ac7
libFLAC/fixed.c: Fix undefined behaviour

Left shift if a negative integer such that the sign bit is affected is
(according to the C spec) undefined behaviour and the residual
calculations using the shift operator were hitting this.

Fortunately these same calculations using plain multiplication do not
invoke UB and according to benchmarking (on x86_64 linux) have the same
performance as the bit shift version.
src/libFLAC/fixed.c