- Fix that __is_power2 returns false on 1 and 2.
- Change all uses of __is_power2 in hashtable to __is_rehash_power2 which retains the old behavior.
- Handle 0 and 1 as special cases in __next_pow2. Prevents calling __clz(0) which is undefined behavior.
I use these functions in the polymorphic allocator implementation I'm working on. For that reason I think we should fix this.
Looks to me that this produces:
0 --> 1
1 --> 1
2 --> 4
4 --> 8
Is that the intended behavior? (especially the second one)