[PATCH 2 of 3] xdiff: silence a 32-bit shift warning on Windows
Matt Harbison
mharbison72 at gmail.com
Sat Mar 10 03:07:02 UTC 2018
# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1520649753 18000
# Fri Mar 09 21:42:33 2018 -0500
# Node ID 1f313a913f4356f272ef275061d5d169d9c1690e
# Parent d3b978ff5c3fc50b33b3ca8f6c371df23d46404b
xdiff: silence a 32-bit shift warning on Windows
It's probably harmless, but:
warning C4334: '<<' : result of 32-bit shift implicitly converted to 64 bits
(was 64-bit shift intended?)
Adding a 'ULL' suffix to 1 also works, but I doubt that's portable.
diff --git a/mercurial/thirdparty/xdiff/xprepare.c b/mercurial/thirdparty/xdiff/xprepare.c
--- a/mercurial/thirdparty/xdiff/xprepare.c
+++ b/mercurial/thirdparty/xdiff/xprepare.c
@@ -71,7 +71,7 @@
cf->flags = flags;
cf->hbits = xdl_hashbits(size);
- cf->hsize = 1 << cf->hbits;
+ cf->hsize = ((uint64_t)1) << cf->hbits;
if (xdl_cha_init(&cf->ncha, sizeof(xdlclass_t), size / 4 + 1) < 0) {
@@ -263,7 +263,7 @@
{
hbits = xdl_hashbits(narec);
- hsize = 1 << hbits;
+ hsize = ((uint64_t)1) << hbits;
if (!(rhash = (xrecord_t **) xdl_malloc(hsize * sizeof(xrecord_t *))))
goto abort;
memset(rhash, 0, hsize * sizeof(xrecord_t *));
More information about the Mercurial-devel
mailing list