Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cast to unsigned while left bit-shifting #28

Closed
wants to merge 1 commit into from

Conversation

Nsane457
Copy link

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

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

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
Copy link

This can be simplified to:

static const int kMinSignedValue = -(1 << kScaleBits);

@jcowgill
Copy link

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.

@Nsane457
Copy link
Author

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
Copy link

jcowgill commented Jun 14, 2016

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

@Nsane457
Copy link
Author

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
Copy link
Owner

mpruett commented Nov 20, 2016

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

@mpruett mpruett closed this Nov 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants