Fix some example code

This commit is contained in:
Justine Tunney 2021-08-10 13:38:27 -07:00
parent 79ba5233db
commit 31a37aeb1a
3 changed files with 10 additions and 11 deletions

View file

@ -36,9 +36,8 @@ uint64_t Modulus(uint64_t x, struct Modulus m) {
} }
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
printf("%lx %% %d = %d\n", 3, 23, Modulus(23, GetModulus(3))); printf("%#lx %% %d = %d\n", 0x23, 3, Modulus(23, GetModulus(3)));
printf("%lx %% %d = %d\n", 3, 23, printf("%#lx %% %d = %d\n", 0x123, 17, Modulus(0x123, GetModulus(17)));
Modulus(0xf5bd76d4c3c91f47, GetModulus(34)));
volatile struct Modulus v = GetModulus(3); volatile struct Modulus v = GetModulus(3);
volatile uint64_t x = 23, y = 3, z; volatile uint64_t x = 23, y = 3, z;
EZBENCH2("modulus", donothing, z = x % y); EZBENCH2("modulus", donothing, z = x % y);

View file

@ -17,10 +17,10 @@ COSMOPOLITAN_C_START_
* 0xffffffff 0 0 1 31 0 * 0xffffffff 0 0 1 31 0
*/ */
int bsf(int); int bsf(int) pureconst;
int bsfl(long); int bsfl(long) pureconst;
int bsfll(long long); int bsfll(long long) pureconst;
int bsfmax(uintmax_t); int bsfmax(uintmax_t) pureconst;
#if defined(__GNUC__) && !defined(__STRICT_ANSI__) #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
#define bsf(u) \ #define bsf(u) \

View file

@ -17,10 +17,10 @@ COSMOPOLITAN_C_START_
* 0xffffffff 0 0 1 31 0 * 0xffffffff 0 0 1 31 0
*/ */
int bsr(int); int bsr(int) pureconst;
int bsrl(long); int bsrl(long) pureconst;
int bsrll(long long); int bsrll(long long) pureconst;
int bsrmax(uintmax_t); int bsrmax(uintmax_t) pureconst;
#if defined(__GNUC__) && defined(__x86_64__) && !defined(__STRICT_ANSI__) #if defined(__GNUC__) && defined(__x86_64__) && !defined(__STRICT_ANSI__)
#define bsr(u) \ #define bsr(u) \