Reduce initial alloc by 4 (to take into account limb size)

This commit is contained in:
Patrick Pelissier committed 2017-03-27 13:55:09 +02:00
1 parent c3e658d09a
commit 0f144f06a5
1 file changed
+2 -2
+2 -2
View File
@@ -40,7 +40,7 @@ typedef unsigned int bitset_limb;
typedef struct bitset_s {
size_t size; // Size is the number of bits
size_t alloc; // Alloc is the number of allocated bytes
size_t alloc; // Alloc is the number of allocated limbs
bitset_limb *ptr;
} bitset_t[1];
@@ -51,7 +51,7 @@ typedef struct bitset_it_s {
} bitset_it_t[1];
// Compute alloc from size.
#define BITSETI_INC_ALLOC_SIZE(n) ((n) < 8 ? 16 : (n) * 2)
#define BITSETI_INC_ALLOC_SIZE(n) ((n) < 2 ? 4 : (n) * 2)
#define BITSETI_TO_ALLOC(n) (((n) + BITSET_LIMB_BIT - 1) / BITSET_LIMB_BIT)
#define BITSETI_FROM_ALLOC(n) ((n) * BITSET_LIMB_BIT)