Hi,
In [1], David and I talked about a requirement that a user just want
to unset the all bits in a Bitmapset but keep the allocated memory
un-deallocated for later use. It is impossible for the current
Bitmapset. So David suggested a Bitset struct for this purpose. I start
this new thread so that the original thread can focus on its own
purpose.
commit 0ee7e4789e58d6820e4c1ff62979910c0b01cdbb (HEAD -> s_stuck_v2)
Author: yizhi.fzh <yizhi.fzh@alibaba-inc.com>
Date: Thu Jan 18 16:52:30 2024 +0800
Introduce a Bitset data struct.
While Bitmapset is designed for variable-length of bits, Bitset is
designed for fixed-length of bits, the fixed length must be specified at
the bitset_init stage and keep unchanged at the whole lifespan. Because
of this, some operations on Bitset is simpler than Bitmapset.
The bitset_clear unsets all the bits but kept the allocated memory, this
capacity is impossible for bit Bitmapset for some solid reasons.
Also for performance aspect, the functions for Bitset removed some
unlikely checks, instead with some Asserts.
[1]
https://www.postgresql.org/message-id/CAApHDvpdp9LyAoMXvS7iCX-t3VonQM3fTWCmhconEvORrQ%2BZYA%40mail.gmail.com
Any feedback is welcome.
--
Best Regards
Andy Fan