From 9322ce21eeb4ad92d0cdd37d0d62a69368042fec Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ren=C3=A9=20Scharfe?= Date: Tue, 22 May 2012 22:36:25 +0200 Subject: [PATCH] xdiff: avoid compiler warnings with XDL_FAST_HASH on 32-bit machines MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- xdiff/xutils.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xdiff/xutils.c b/xdiff/xutils.c index 1b3b471ac..277ccdff0 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) -- 2.26.2