[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bitpack search in bitsets
From: |
Bruno Haible |
Subject: |
bitpack search in bitsets |
Date: |
Tue, 17 Nov 2020 22:50:40 +0100 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-193-generic; KDE/5.18.0; x86_64; ; ) |
Hi Akim,
In gnulib/lib/ssfmalloc-bitmap.h there is a function
/* Returns the smallest index k >= 0 for which the bit packet of c consecutive
bits (1 <= c <= 32) is all set in the bitmap consisting of num_words words.
Returns (size_t)(-1) if there is none. */
I can easily extend this to c > 32. So, this will be a one-pass search for
c consecutive bits in a bitmap, that operates on words and fetches every word
only twice at most.
Is this something that could be useful for your 'bitset' module? (I know that
it's probably not useful for 'bison'.)
Bruno
- bitpack search in bitsets,
Bruno Haible <=