/////////////////////////////////////////////////////////////////////////// Helper functions ///////////////////////////////////////////////////////////////////////////
| 51 | // Helper functions |
| 52 | //////////////////////////////////////////////////////////////////////////////// |
| 53 | int snapTransformSize(int dataSize) |
| 54 | { |
| 55 | int hiBit; |
| 56 | unsigned int lowPOT, hiPOT; |
| 57 | |
| 58 | dataSize = iAlignUp(dataSize, 16); |
| 59 | |
| 60 | for (hiBit = 31; hiBit >= 0; hiBit--) |
| 61 | if (dataSize & (1U << hiBit)) { |
| 62 | break; |
| 63 | } |
| 64 | |
| 65 | lowPOT = 1U << hiBit; |
| 66 | |
| 67 | if (lowPOT == (unsigned int)dataSize) { |
| 68 | return dataSize; |
| 69 | } |
| 70 | |
| 71 | hiPOT = 1U << (hiBit + 1); |
| 72 | |
| 73 | if (hiPOT <= 1024) { |
| 74 | return hiPOT; |
| 75 | } |
| 76 | else { |
| 77 | return iAlignUp(dataSize, 512); |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | float getRand(void) { return (float)(rand() % 16); } |
| 82 |