Skip to content

Commit

Permalink
xdiff: avoid compiler warnings with XDL_FAST_HASH on 32-bit machines
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
René Scharfe authored and Junio C Hamano committed May 22, 2012
1 parent 6f1af02 commit 9322ce2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions xdiff/xutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9322ce2

Please sign in to comment.