From fd6f917a604c38c90d9c8bfcb5b907c43297e70a Mon Sep 17 00:00:00 2001 From: Ron Yorston <rmy@pobox.com> Date: Mon, 5 Jul 2021 12:25:51 +0100 Subject: awk: WIN32 compilation fixes --- editors/awk.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/editors/awk.c b/editors/awk.c index c88b8e1c4..5a26d389f 100644 --- a/editors/awk.c +++ b/editors/awk.c @@ -915,7 +915,7 @@ static int fmt_num(char *b, int size, const char *format, double n, int int_as_i const char *s = format; if (int_as_int && n == (long long)n) { - r = snprintf(b, size, "%lld", (long long)n); + r = snprintf(b, size, "%"LL_FMT"d", (long long)n); } else { do { c = *s; } while (c && *++s); if (strchr("diouxX", c)) { @@ -3206,6 +3206,12 @@ static var *evaluate(node *op, var *res) v &= 0x7fffffffffffffffULL; # endif R_d = (double)v / 0x8000000000000000ULL; +#elif ENABLE_PLATFORM_MINGW32 && RAND_MAX == 0x7fff + /* 45 bits of randomness ought to be enough for anyone */ + uint64_t v = ((uint64_t)rand() << 48) | + ((uint64_t)rand() << 33) | + ((uint64_t)rand() << 18); + R_d = (double)v / 0x8000000000000000ULL; #else # error Not implemented for this value of RAND_MAX #endif -- cgit v1.2.3-55-g6feb