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

Check implicit type conversions in make_rng_state #107

Open
luhuhis opened this issue Aug 23, 2022 · 0 comments
Open

Check implicit type conversions in make_rng_state #107

luhuhis opened this issue Aug 23, 2022 · 0 comments
Labels
question Further information is requested

Comments

@luhuhis
Copy link
Collaborator

luhuhis commented Aug 23, 2022

Do we have to worry about the implicit type conversion from long int to unsigned int in this function?
lrand48 returns long ints, the aux_* variables are initialized as int, but later they are put into uint4 structs. Is this intended or just a small oversight?

int aux_x, aux_y, aux_z, aux_w;
std::vector<uint4> temp;
size_t globalVol = GInd::getLatData().globvol4;
for (size_t i = 0; i < globalVol; ++i)
{
while ( ( aux_x = lrand48() ) <= 128 ) {};
while ( ( aux_y = lrand48() ) <= 128 ) {};
while ( ( aux_z = lrand48() ) <= 128 ) {};
aux_w = lrand48();
uint4 dummy=make_uint4(aux_x, aux_y, aux_z, aux_w);

@luhuhis luhuhis added the question Further information is requested label Aug 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant