Lines Matching +full:integer +full:- +full:n
9 * https://github.com/imneme/pcg-c
11 * -----------------------------------------------------------------------------
15 * Copyright (c) 2014-2017 Melissa O'Neill and PCG Project contributors
16 * Copyright (c) 2018-2025 Gavin D. Howard and contributors.
72 // If longs are 64 bits, we have the option of 128-bit integers on some
104 * @param a The first integer.
105 * @param b The second integer.
112 * @param a The first integer.
113 * @param b The second integer.
140 #define BC_RAND_NOTMODIFIED(r) (((r)->inc & 1UL) == 0)
147 #define BC_RAND_ZERO(r) (!(r)->state)
158 * Truncates a PCG state to the number of bits in a random integer.
193 * @param a The first integer.
194 * @param b The second integer.
201 * @param a The first integer.
202 * @param b The second integer.
229 #define BC_RAND_NOTMODIFIED(r) (((r)->inc.lo & 1) == 0)
236 #define BC_RAND_ZERO(r) (!(r)->state.lo && !(r)->state.hi)
247 * Truncates a PCG state to the number of bits in a random integer.
263 * @return The semi-rotated state.
267 /// A 64-bit integer with the bottom 32 bits set.
271 * Returns the 32-bit truncated value of @a n.
272 * @param n The integer to truncate.
273 * @return The bottom 32 bits of @a n.
275 #define BC_RAND_TRUNC32(n) ((n) & (BC_RAND_BOTTOM32)) argument
278 * Returns the second 32 bits of @a n.
279 * @param n The integer to truncate.
280 * @return The second 32 bits of @a n.
282 #define BC_RAND_CHOP32(n) ((n) >> 32) argument
299 // If we are using 32-bit longs, we need to set these so.
314 * @param a The first integer.
315 * @param b The second integer.
322 * @param a The first integer.
323 * @param b The second integer.
350 #define BC_RAND_NOTMODIFIED(r) (((r)->inc & 1UL) == 0)
357 #define BC_RAND_ZERO(r) (!(r)->state)
361 * @param n The number.
362 * @return The constant built from @a n.
364 #define BC_RAND_CONSTANT(n) UINT64_C(n) argument
370 * Truncates a PCG state to the number of bits in a random integer.
386 * @return The semi-rotated state.
406 ((BcRand) (((v) >> (r)) | ((v) << ((0 - (r)) & BC_RAND_ROTC))))
408 /// The number of bits in a random integer.
414 /// The size of a BcNum with the max random integer. This isn't exact; it's
419 #define BC_RAND_SRAND_BITS ((1 << CHAR_BIT) - 1)
461 * Returns a random integer from the PRNG.
463 * @return A random integer.
469 * Returns a random integer from the PRNG bounded by @a bound. Bias is
472 * @param bound The bound for the random integer.
473 * @return A bounded random integer.