From 0f144f06a55220300b06eb1c7e615d93de674e5b Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Mon, 27 Mar 2017 13:55:09 +0200 Subject: [PATCH] Reduce initial alloc by 4 (to take into account limb size) --- m-bitset.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/m-bitset.h b/m-bitset.h index 9f102391..9d5018f3 100644 --- a/m-bitset.h +++ b/m-bitset.h @@ -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)