summaryrefslogtreecommitdiff
path: root/xdiff
diff options
context:
space:
mode:
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>2012-05-22 22:36:25 +0200
committerJunio C Hamano <gitster@pobox.com>2012-05-22 14:39:49 -0700
commit9322ce21eeb4ad92d0cdd37d0d62a69368042fec (patch)
tree7ef2ad2a7110619b33fe850c85170ad5cdc0fc1e /xdiff
parent6f1af028ce0654ef6233dff06701a989d5703bc4 (diff)
downloadgit-9322ce21eeb4ad92d0cdd37d0d62a69368042fec.tar.gz
xdiff: avoid compiler warnings with XDL_FAST_HASH on 32-bit machines
Import macro REPEAT_BYTE from Linux (arch/x86/include/asm/word-at-a-time.h) to avoid 64-bit integer literals, which cause some 32-bit compilers to print warnings. Reported-by: Øyvind A. Holm <sunny@sunbase.org> Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'xdiff')
-rw-r--r--xdiff/xutils.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/xdiff/xutils.c b/xdiff/xutils.c
index 1b3b471ac8..277ccdff02 100644
--- a/xdiff/xutils.c
+++ b/xdiff/xutils.c
@@ -280,9 +280,11 @@ static unsigned long xdl_hash_record_with_whitespace(char const **data,
#ifdef XDL_FAST_HASH
-#define ONEBYTES 0x0101010101010101ul
-#define NEWLINEBYTES 0x0a0a0a0a0a0a0a0aul
-#define HIGHBITS 0x8080808080808080ul
+#define REPEAT_BYTE(x) ((~0ul / 0xff) * (x))
+
+#define ONEBYTES REPEAT_BYTE(0x01)
+#define NEWLINEBYTES REPEAT_BYTE(0x0a)
+#define HIGHBITS REPEAT_BYTE(0x80)
/* Return the high bit set in the first byte that is a zero */
static inline unsigned long has_zero(unsigned long a)