commit 16e8cc34eac3c9edeea208e2f2b1438e324bef58 parent 1d8d3d821527ba498e32fae6c1b96aadaf5fbb9b Author: Michael Savage <mikejsavage@gmail.com> Date: Fri Dec 30 12:56:02 +0200 Fix the last MSVC warning Diffstat:
rng/rng_utils.h | | | 2 | +- |
diff --git a/rng/rng_utils.h b/rng/rng_utils.h @@ -44,7 +44,7 @@ u32 rng_uniform( T * rng, u32 upper_bound ) { if( upper_bound < 2 ) return 0; /* 2**32 % x == (2**32 - x) % x */ - u32 min = -upper_bound % upper_bound; + u32 min = (~upper_bound + 1) % upper_bound; /* * This could theoretically loop forever but each retry has