2 Replies Latest reply on Feb 28, 2012 11:52 PM by mobileappsgallery

    A bug in the Sample

    viscocoa

      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, ...