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>
René Scharfe committed
May 22, 2012 at 22:36 UTC
9322ce21eeb4ad92d0cdd37d0d62a69368042fec
1 file changed
+5
-3
xdiff/xutils.c
+5
-3
@@ -280,9 +280,11 @@ static unsigned long xdl_hash_record_with_whitespace(char const **data,
280
281
#ifdef XDL_FAST_HASH
282
283
-#define ONEBYTES 0x0101010101010101ul
284
-#define NEWLINEBYTES 0x0a0a0a0a0a0a0a0aul
285
-#define HIGHBITS 0x8080808080808080ul
283
+#define REPEAT_BYTE(x) ((~0ul / 0xff) * (x))
284
+
285
+#define ONEBYTES REPEAT_BYTE(0x01)
286
+#define NEWLINEBYTES REPEAT_BYTE(0x0a)
287
+#define HIGHBITS REPEAT_BYTE(0x80)
288
289
/* Return the high bit set in the first byte that is a zero */
290
static inline unsigned long has_zero(unsigned long a)