the default implementation calls memcpy on an `alloca` constant, which
seems to heavily confuse the optimizer and produces overall suboptimal
code.
Introducing this specialization simplifies the intermediate
representation produced, resulting in more efficient code.
This could be easier to predict in cases where one of `left` and `right`
is significantly greater than the other, and as such the same branch is
taken multiple times in a row
This commit includes two fixes:
- a temporary cast to make the function compile
- a fix to a logic error that caused the function to hang or return
incorrect results
The `if` statement should have been a `for` loop, in order to allow recursively
sorting the subarrays with quicksort, and not resort to shell sort after
one step.
calling `clear` on a `bit_array` no longer leaks the previous
allocation, instead it sets all bits to `false` preserving the same
backing dynamic array.
It's now possible to iterate over:
- all keys in the range min_value ..= max_value, with `iterate_all`
- all set keys in the bit array, with `iterate_set`
- all unset keys in the range min_value ..= max_value, with `iterate_unset`
`Bit_Array` now stores the `max_value` provided during construction, and
updates it when a key that was previously out of range is set.