How to convert bitarray to set quickly with c++? Each of the actual bitarrays has 750,000 bits.
Example 1:
bitarray: 01011111
set: {0,1,2,3,4,5,7}
or set: {1,3,4,5,6,7}
Example 2:
bitarray: 0101 1111 0001 0001
set: {0,4,8,9,10,11,12,14}
or set: {1,3,4,5,6,7,11,15}
The set is an array of usigned 32 bit integers (uint32_t). Both kinds of set are acceptable.
The bitarray is contiguous in memory. The first bit of the bitarray has correct alignment for simd. For now I am using a custom memory allocator with std::vector to hold the bitarray. 1 bit in memory per 1 bit in the bitarray.
Thanks.
Update:
this so question does the reverse
How to define and work with an array of bits in C?
gmpy uses the scan1 function of the gmp library. scan1 seems find first set, as in wikipedia here