aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2021-07-03 11:57:59 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2021-07-03 11:57:59 +0200
commit0e3ef4efb061366bfa4b9609fe3a03f3a1e40f0e (patch)
treee055bbb3e7e4576825e0212cbc095757bafc5f7f
parent2211fa70ccad29fc7bccd34c13141850ebb199da (diff)
downloadbusybox-w32-0e3ef4efb061366bfa4b9609fe3a03f3a1e40f0e.tar.gz
busybox-w32-0e3ef4efb061366bfa4b9609fe3a03f3a1e40f0e.tar.bz2
busybox-w32-0e3ef4efb061366bfa4b9609fe3a03f3a1e40f0e.zip
awk: rand(): 64-bit constants should be ULL
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--editors/awk.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/editors/awk.c b/editors/awk.c
index 4119253ec..e4dd6684c 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -3169,9 +3169,9 @@ static var *evaluate(node *op, var *res)
3169 uint64_t v = ((uint64_t)rand() << 32) | u; 3169 uint64_t v = ((uint64_t)rand() << 32) | u;
3170 /* the above shift+or is optimized out on 32-bit arches */ 3170 /* the above shift+or is optimized out on 32-bit arches */
3171# if RAND_MAX > 0x7fffffff 3171# if RAND_MAX > 0x7fffffff
3172 v &= 0x7fffffffffffffffUL; 3172 v &= 0x7fffffffffffffffULL;
3173# endif 3173# endif
3174 R_d = (double)v / 0x8000000000000000UL; 3174 R_d = (double)v / 0x8000000000000000ULL;
3175#else 3175#else
3176# error Not implemented for this value of RAND_MAX 3176# error Not implemented for this value of RAND_MAX
3177#endif 3177#endif