cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

viscocoa
Adept I

A bug in the Sample

In the file SDKCommon.cpp

template<typename T>
T SDKCommon::roundToPowerOf2(T val)
{
    int bytes = sizeof(T);

    val--;
    for(int i = 0; i < bytes; i++)
        val |= val >> (1<<i); 
    val++;

    return val;
}

This is wrong. The times of loop should be 3 for 8 bit number, 4 for 16 bit number, 5 for 32 bit number, ...

Tags (1)
0 Likes
2 Replies
MicahVillmow
Staff
Staff

Re: A bug in the Sample

Thanks for reporting this, I've let the appropriate people to get it fixed know about it.

0 Likes
mobileappsgallery
Journeyman III

Re: A bug in the Sample

Thanks for sharing

0 Likes