From 31a37aeb1a5e095a7d4d424573ef9e4d652c7819 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Tue, 10 Aug 2021 13:38:27 -0700 Subject: [PATCH] Fix some example code --- examples/fastmod.c | 5 ++--- libc/nexgen32e/bsf.h | 8 ++++---- libc/nexgen32e/bsr.h | 8 ++++---- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/examples/fastmod.c b/examples/fastmod.c index cca365fa9..254e38f38 100644 --- a/examples/fastmod.c +++ b/examples/fastmod.c @@ -36,9 +36,8 @@ uint64_t Modulus(uint64_t x, struct Modulus m) { } int main(int argc, char *argv[]) { - printf("%lx %% %d = %d\n", 3, 23, Modulus(23, GetModulus(3))); - printf("%lx %% %d = %d\n", 3, 23, - Modulus(0xf5bd76d4c3c91f47, GetModulus(34))); + printf("%#lx %% %d = %d\n", 0x23, 3, Modulus(23, GetModulus(3))); + printf("%#lx %% %d = %d\n", 0x123, 17, Modulus(0x123, GetModulus(17))); volatile struct Modulus v = GetModulus(3); volatile uint64_t x = 23, y = 3, z; EZBENCH2("modulus", donothing, z = x % y); diff --git a/libc/nexgen32e/bsf.h b/libc/nexgen32e/bsf.h index 3f6a0cd31..5869080d0 100644 --- a/libc/nexgen32e/bsf.h +++ b/libc/nexgen32e/bsf.h @@ -17,10 +17,10 @@ COSMOPOLITAN_C_START_ * 0xffffffff 0 0 1 31 0 */ -int bsf(int); -int bsfl(long); -int bsfll(long long); -int bsfmax(uintmax_t); +int bsf(int) pureconst; +int bsfl(long) pureconst; +int bsfll(long long) pureconst; +int bsfmax(uintmax_t) pureconst; #if defined(__GNUC__) && !defined(__STRICT_ANSI__) #define bsf(u) \ diff --git a/libc/nexgen32e/bsr.h b/libc/nexgen32e/bsr.h index d1e65a10d..b694a5b63 100644 --- a/libc/nexgen32e/bsr.h +++ b/libc/nexgen32e/bsr.h @@ -17,10 +17,10 @@ COSMOPOLITAN_C_START_ * 0xffffffff 0 0 1 31 0 */ -int bsr(int); -int bsrl(long); -int bsrll(long long); -int bsrmax(uintmax_t); +int bsr(int) pureconst; +int bsrl(long) pureconst; +int bsrll(long long) pureconst; +int bsrmax(uintmax_t) pureconst; #if defined(__GNUC__) && defined(__x86_64__) && !defined(__STRICT_ANSI__) #define bsr(u) \