Skip to content

Commit

Permalink
SDL_rand returns a Uint32, which needs a cast to Sint32 to avoid wrap…
Browse files Browse the repository at this point in the history
…ping to UINT32_MAX
  • Loading branch information
madebr committed Jun 19, 2024
1 parent af763ce commit 9880713
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/testnative.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ int main(int argc, char *argv[])
velocities[i].x = 0.0f;
velocities[i].y = 0.0f;
while (velocities[i].x == 0.f && velocities[i].y == 0.f) {
velocities[i].x = (float)((SDL_rand() % (MAX_SPEED * 2 + 1)) - MAX_SPEED);
velocities[i].y = (float)((SDL_rand() % (MAX_SPEED * 2 + 1)) - MAX_SPEED);
velocities[i].x = (float)(((Sint32)SDL_rand() % (MAX_SPEED * 2 + 1)) - MAX_SPEED);
velocities[i].y = (float)(((Sint32)SDL_rand() % (MAX_SPEED * 2 + 1)) - MAX_SPEED);
}
}

Expand Down

0 comments on commit 9880713

Please sign in to comment.