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

Fix C++11 warning - left shift of signed value is undefined #79

Merged
merged 2 commits into from
Jan 10, 2018

Conversation

iainmerrick
Copy link
Contributor

@iainmerrick iainmerrick commented Sep 26, 2017

A couple of small tweaks that I needed for a clean compile in Clang with pedantic warnings

@@ -52,7 +52,7 @@ static const uint32 yMask = ((1u << yTruncBits) - 1u) << yShift;
static const uint32 xMask = ~yMask;
static const uint32 relativeTagRight = 1u << xShift;
static const uint32 relativeTagBottomLeft = (uint32)((1 << yShift) +
(-1 << xShift));
(UINT32_MAX << xShift));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UINT32_MAX is a Windows specific constant. Instead you could do...

~((uint32)0) << xShift

which is pretty much the same thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UINT32_MAX isn't Windows, it's C99. But I've gone ahead and made that change.

@@ -75,7 +75,7 @@ typedef unsigned long long uint64;
// We expand the API so that other languages (e.g. Java) can call into
// our C++ more easily. Only set if when the flag is not externally defined.
#if !defined(LIQUIDFUN_EXTERNAL_LANGUAGE_API)
#if SWIG || LIQUIDFUN_UNIT_TESTS
#if defined(SWIG) || defined(LIQUIDFUN_UNIT_TESTS)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we have another instance of this in

worth fixing as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, done

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

@googlebot
Copy link

CLAs look good, thanks!

@stewartmiles
Copy link
Contributor

Thanks @iainmerrick

@stewartmiles stewartmiles merged commit 7f20402 into google:master Jan 10, 2018
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.

3 participants