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

C4146 in VS 2013 #10

Open
zno5 opened this issue Jun 4, 2017 · 2 comments
Open

C4146 in VS 2013 #10

zno5 opened this issue Jun 4, 2017 · 2 comments

Comments

@zno5
Copy link

zno5 commented Jun 4, 2017

uint32_t pcg32_random_r(pcg32_random_t* rng);

I got an error message C4146 when I compiled this function with vs 2013.
the problem is the minus op applied to unsigned type variable rot(in the return code).

Could you change that code like ~rot + 1 instead of -rot.

thanks.

and I think this following issue is minor...
I think xorshifted variable would need a casting op. like this
uint32_t xorshifted = (uint32_t) (((oldstate >> 18u) ^ oldstate) >> 27u);

@Srekel
Copy link

Srekel commented Oct 28, 2017

Same here with VS2017. Could "fix" it by adding
#pragma warning( disable : 4146 )
But zno5's solution might be better.

@lemire
Copy link

lemire commented Oct 28, 2017

The question is whether the warning is legitimate as per the language specification.

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

No branches or pull requests

3 participants