Fix a rounding calculation that could undersize a bitstring on
Add sys/param.h for the roundup2 macro
asomers on Jun 14 2016, 11:24 PM.Authored by
Existing ATF test cases
I see how this can over allocate on platforms with long > 8bits, but I'm missing how 32bit long platforms are special and can get too little space allocated. Can you provide an example in the checkin comment?
If I want to dynamically allocate a bitstr, I use bitstr_size() to tell me how much to allocate. Without the roundup, I'll potentially allocate too little memory.
I would say that you should use bit_alloc. But plenty of callers are doing it themselves. I'll do as you suggest, which will basically revert the 2nd diff of this review.