Commit ca6c2760 authored by Marek Kolodziej's avatar Marek Kolodziej
Browse files

Bug fix in next power of 2

parent 603e17a5
......@@ -20,13 +20,13 @@ __device__ __forceinline__ int lastpow2(int n)
}
__host__ __forceinline__ int h_next_pow2(unsigned int n) {
unsigned int old = n;
n--;
n |= (n >> 1);
n |= (n >> 2);
n |= (n >> 4);
n |= (n >> 8);
n |= (n >> 16);
return n == old? n : n + 1;
return ++n;
}
__host__ __forceinline__ int h_last_pow2(unsigned int n) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment