Unverified Commit 1603407b authored by jjsjann123's avatar jjsjann123 Committed by GitHub
Browse files

Merge pull request #176 from NVIDIA/next_pow2_fix

Bug fix in next power of 2
parents 603e17a5 ca6c2760
......@@ -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