]> arthur.barton.de Git - bup.git/commitdiff
One more constant for header lengths
authorBrandon Low <lostlogic@lostlogicx.com>
Thu, 17 Feb 2011 04:09:45 +0000 (20:09 -0800)
committerAvery Pennarun <apenwarr@gmail.com>
Thu, 17 Feb 2011 09:09:54 +0000 (01:09 -0800)
I missed bloom header length in the last pass.

Signed-off-by: Brandon Low <lostlogic@lostlogicx.com>
lib/bup/_helpers.c

index 31f022387000d2e8de7c1d37e08de32bc940b7c8..f1b8d72252f0ac5e0f9786b476ab591b11a7ff28 100644 (file)
@@ -133,12 +133,13 @@ static PyObject *firstword(PyObject *self, PyObject *args)
 }
 
 
+#define BLOOM2_HEADERLEN 16
+
 typedef struct {
     uint32_t high;
     unsigned char low;
 } bits40_t;
 
-
 static void to_bloom_address_bitmask4(const bits40_t *buf,
        const int nbits, uint64_t *v, unsigned char *bitmask)
 {
@@ -165,14 +166,13 @@ static void to_bloom_address_bitmask5(const uint32_t *buf,
     *bitmask = 1 << bit;
 }
 
-
 #define BLOOM_SET_BIT(name, address, itype, otype) \
 static void name(unsigned char *bloom, const void *buf, const int nbits)\
 {\
     unsigned char bitmask;\
     otype v;\
     address((itype *)buf, nbits, &v, &bitmask);\
-    bloom[16+v] |= bitmask;\
+    bloom[BLOOM2_HEADERLEN+v] |= bitmask;\
 }
 BLOOM_SET_BIT(bloom_set_bit4, to_bloom_address_bitmask4, bits40_t, uint64_t)
 BLOOM_SET_BIT(bloom_set_bit5, to_bloom_address_bitmask5, uint32_t, uint32_t)
@@ -184,7 +184,7 @@ static int name(const unsigned char *bloom, const void *buf, const int nbits)\
     unsigned char bitmask;\
     otype v;\
     address((itype *)buf, nbits, &v, &bitmask);\
-    return bloom[16+v] & bitmask;\
+    return bloom[BLOOM2_HEADERLEN+v] & bitmask;\
 }
 BLOOM_GET_BIT(bloom_get_bit4, to_bloom_address_bitmask4, bits40_t, uint64_t)
 BLOOM_GET_BIT(bloom_get_bit5, to_bloom_address_bitmask5, uint32_t, uint32_t)