diff options
author | Junio C Hamano <junkio@cox.net> | 2006-10-16 21:58:54 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-10-16 21:58:54 -0700 |
commit | 3453f862e1c74e400da67def9b810300ef90c3ac (patch) | |
tree | cccd112737f2cefd3841ea394c8c141913b3be7e /xdiff | |
parent | svnimport: Fix broken tags being generated (diff) | |
parent | Fix hash function in xdiff library (diff) | |
download | tgif-3453f862e1c74e400da67def9b810300ef90c3ac.tar.xz |
Merge branch 'maint'
* maint:
Fix hash function in xdiff library
Diffstat (limited to 'xdiff')
-rw-r--r-- | xdiff/xmacros.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/xdiff/xmacros.h b/xdiff/xmacros.h index 4c2fde80c1..e2cd2023b3 100644 --- a/xdiff/xmacros.h +++ b/xdiff/xmacros.h @@ -24,14 +24,15 @@ #define XMACROS_H -#define GR_PRIME 0x9e370001UL #define XDL_MIN(a, b) ((a) < (b) ? (a): (b)) #define XDL_MAX(a, b) ((a) > (b) ? (a): (b)) #define XDL_ABS(v) ((v) >= 0 ? (v): -(v)) #define XDL_ISDIGIT(c) ((c) >= '0' && (c) <= '9') -#define XDL_HASHLONG(v, b) (((unsigned long)(v) * GR_PRIME) >> ((CHAR_BIT * sizeof(unsigned long)) - (b))) +#define XDL_ADDBITS(v,b) ((v) + ((v) >> (b))) +#define XDL_MASKBITS(b) ((1UL << (b)) - 1) +#define XDL_HASHLONG(v,b) (XDL_ADDBITS((unsigned long)(v), b) & XDL_MASKBITS(b)) #define XDL_PTRFREE(p) do { if (p) { xdl_free(p); (p) = NULL; } } while (0) #define XDL_LE32_PUT(p, v) \ do { \ |