MCPcopy Create free account
hub / github.com/NVIDIA/cuda-samples / snapTransformSize

Function snapTransformSize

cpp/5_Domain_Specific/convolutionFFT2D/main.cpp:53–79  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////////////// Helper functions ///////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

51// Helper functions
52////////////////////////////////////////////////////////////////////////////////
53int 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
81float getRand(void) { return (float)(rand() % 16); }
82

Callers 3

test0Function · 0.85
test1Function · 0.85
test2Function · 0.85

Calls 1

iAlignUpFunction · 0.70

Tested by

no test coverage detected