diff options
author | Ron Yorston <rmy@pobox.com> | 2021-07-05 12:25:51 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2021-07-05 12:25:51 +0100 |
commit | fd6f917a604c38c90d9c8bfcb5b907c43297e70a (patch) | |
tree | 3a4d25cd1ba2c4b84609017c18313d2119b0d4f1 | |
parent | 57261b6b3a6d2955a5abd6a0563fe78ba43abf3f (diff) | |
download | busybox-w32-fd6f917a604c38c90d9c8bfcb5b907c43297e70a.tar.gz busybox-w32-fd6f917a604c38c90d9c8bfcb5b907c43297e70a.tar.bz2 busybox-w32-fd6f917a604c38c90d9c8bfcb5b907c43297e70a.zip |
awk: WIN32 compilation fixes
-rw-r--r-- | editors/awk.c | 8 |
1 files changed, 7 insertions, 1 deletions
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 | |||
915 | const char *s = format; | 915 | const char *s = format; |
916 | 916 | ||
917 | if (int_as_int && n == (long long)n) { | 917 | if (int_as_int && n == (long long)n) { |
918 | r = snprintf(b, size, "%lld", (long long)n); | 918 | r = snprintf(b, size, "%"LL_FMT"d", (long long)n); |
919 | } else { | 919 | } else { |
920 | do { c = *s; } while (c && *++s); | 920 | do { c = *s; } while (c && *++s); |
921 | if (strchr("diouxX", c)) { | 921 | if (strchr("diouxX", c)) { |
@@ -3206,6 +3206,12 @@ static var *evaluate(node *op, var *res) | |||
3206 | v &= 0x7fffffffffffffffULL; | 3206 | v &= 0x7fffffffffffffffULL; |
3207 | # endif | 3207 | # endif |
3208 | R_d = (double)v / 0x8000000000000000ULL; | 3208 | R_d = (double)v / 0x8000000000000000ULL; |
3209 | #elif ENABLE_PLATFORM_MINGW32 && RAND_MAX == 0x7fff | ||
3210 | /* 45 bits of randomness ought to be enough for anyone */ | ||
3211 | uint64_t v = ((uint64_t)rand() << 48) | | ||
3212 | ((uint64_t)rand() << 33) | | ||
3213 | ((uint64_t)rand() << 18); | ||
3214 | R_d = (double)v / 0x8000000000000000ULL; | ||
3209 | #else | 3215 | #else |
3210 | # error Not implemented for this value of RAND_MAX | 3216 | # error Not implemented for this value of RAND_MAX |
3211 | #endif | 3217 | #endif |