impl. AppendTo and AsSlice#195
impl. AppendTo and AsSlice#195lemire merged 1 commit intobits-and-blooms:masterfrom gaissmai:fb-append
Conversation
|
huch, wait a moment, a panic test isn't working as expected |
|
ready for merge, or drop it if you don't like |
| // AppendTo appends all set bits to buf and returns the (maybe extended) buf. | ||
| // | ||
| // See also [BitSet.AsSlice] and [BitSet.NextSetMany]. | ||
| func (b *BitSet) AppendTo(buf []uint) []uint { |
There was a problem hiding this comment.
Theoretically, we can overflow uint. It would be nice to mention that what happens if someone has a gigantic bitset.
|
@gaissmai Please see my comment. |
|
I'll will push an update in a few minutes |
|
I'm not a native speaker, maybe you will polish my new docstring. edited: not a native english speaker ;) |
|
@gaissmai Let me explain what I meant. On a 32-bit system, uint maxes out at 2**32 - 1. Meanwhile, the bitset can represent values between 0 and (2**32 - 1) * 64. Right? So It won't overflow in practice. But it is worth saying why. Or, at least, just say 'won't overflow in practice' as a comment. |
|
hm, yes, but this is not different to NextSet and NetxSetMany |
Correct. Let me merge this and I will add comments. |
added AsSlice() and AppendTo() as convenience functions, if you like it, merge it, otherwise drop the PR
thanks for bitset