Closed zmertens closed 6 years ago
I am aware of the non-branching way to calculate the next power of two; however, it is unclear if this section of code needs to be optimized.
The template in alias_table
also does more than rounding up.
OK, I didn't think it'd be that much of a change anyway. I'm just trying to think of ways to improve the code.
https://github.com/reedacartwright/dawg/blob/9c44bdc8cb1ebbfca4cddf4976841d734cf09288/src/include/dawg/utils/aliastable.h#L125-L131
I came across this algorithm here, and it is non-iterative and appears to work very well for 32-bit numbers.
I was wondering what you might think Reed and if it would be worth profiling it?