aboutsummaryrefslogtreecommitdiff
path: root/stdlib/rng.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-12-07 15:59:37 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-12-07 15:59:37 -0500
commita201939a8150bc4c2f221925797ea2751c74b77c (patch)
tree26fee4ec601319fd8771435087931023e393fe92 /stdlib/rng.c
parent683b0f5141ad21914d77cd4b4b81e7e2161f90f3 (diff)
Use likely()/unlikely() macros and a few bugfixes for integers
Diffstat (limited to 'stdlib/rng.c')
-rw-r--r--stdlib/rng.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/stdlib/rng.c b/stdlib/rng.c
index 8104c451..bf23cb74 100644
--- a/stdlib/rng.c
+++ b/stdlib/rng.c
@@ -101,7 +101,7 @@ public Bool_t RNG$bool(RNG_t rng, Num_t p)
public Int_t RNG$int(RNG_t rng, Int_t min, Int_t max)
{
- if (__builtin_expect(((min.small & max.small) & 1) != 0, 1)) {
+ if (likely(((min.small & max.small) & 1) != 0)) {
int32_t r = RNG$int32(rng, (int32_t)(min.small >> 2), (int32_t)(max.small >> 2));
return I_small(r);
}