mpruett / audiofile

Audio File Library
https://audiofile.68k.org/
GNU Lesser General Public License v2.1
156 stars 43 forks source link

Cast to unsigned while left bit-shifting #28

Closed ghost closed 8 years ago

ghost commented 8 years ago

GCC-6 now treats the left bitwise-shift of a negative integer as nonconformant so explicitly cast to an unsigned int while bit-shifting.

ghost commented 8 years ago

Explicit casting should enable the exact same implicit behaviour as pre-gcc6 without having to adjust the algorithm or resort to -fpermissive or a less portable method.

jcowgill commented 8 years ago

This can be simplified to:

static const int kMinSignedValue = -(1 << kScaleBits);
jcowgill commented 8 years ago

Actually on closer look, the unsigned 1 is needed. In any case, more changes are needed to allow autofile to build on GCC 6. I think this PR should be closed in favour of #27 which seems to have everything.

ghost commented 8 years ago

Actually on closer look, the unsigned 1 is needed. In any case, more changes are needed to allow autofile to build on GCC 6.

I've used this to successfully compile with GCC-6.1.0 using both armv7a-hardfloat-linux-gnueabi and x86_64-pc-linux-gnu toolchains so I'm a little confused as to what other changes are necessary.

jcowgill commented 8 years ago

Did you run make check? The other changes fix the testsuite which isn't built by default.

ghost commented 8 years ago

Did you run make check? The other changes fix the testsuite which isn't built by default.

OK. Now I see. You're right.

mpruett commented 8 years ago

Thanks for your suggestion, but I've taken another approach to solve this problem.