Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>2012-05-23 00:36:39 +0400
committerJunio C Hamano <gitster@pobox.com>2012-05-23 20:10:03 +0400
commit7e356a979459092d10450e66d8512381e89c2570 (patch)
treeee8bd50045a1a051f20ccdea507e5a52aab37db3 /xdiff/xutils.c
parent9322ce21eeb4ad92d0cdd37d0d62a69368042fec (diff)
xdiff: avoid more compiler warnings with XDL_FAST_HASH on 32-bit machines
Hide literals that can cause compiler warnings for 32-bit architectures in expressions that evaluate to small numbers there. Some compilers warn that 0x0001020304050608 won't fit into a 32-bit long, others that shifting right by 56 bits clears a 32-bit value completely. The correct values are calculated in the 64-bit case, which is all that matters in this if-branch. Reported-by: Øyvind A. Holm <sunny@sunbase.org> Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Acked-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'xdiff/xutils.c')
-rw-r--r--xdiff/xutils.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/xdiff/xutils.c b/xdiff/xutils.c
index 277ccdff02..2021117799 100644
--- a/xdiff/xutils.c
+++ b/xdiff/xutils.c
@@ -301,7 +301,13 @@ static inline long count_masked_bytes(unsigned long mask)
* that works for the bytemasks without having to
* mask them first.
*/
- return mask * 0x0001020304050608 >> 56;
+ /*
+ * return mask * 0x0001020304050608 >> 56;
+ *
+ * Doing it like this avoids warnings on 32-bit machines.
+ */
+ long a = (REPEAT_BYTE(0x01) / 0xff + 1);
+ return mask * a >> (sizeof(long) * 7);
} else {
/*
* Modified Carl Chatfield G+ version for 32-bit *