MCPcopy Create free account
hub / github.com/GPUOpen-Tools/compressonator / GenerateTestData

Function GenerateTestData

cmp_unittests/codecbuffer_tests.cpp:62–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62static void GenerateTestData(unsigned int numValues = 128, bool isSigned = false)
63{
64 if (g_byteData)
65 free(g_byteData);
66 if (g_sbyteData)
67 free(g_sbyteData);
68 if (g_wordData)
69 free(g_wordData);
70 if (g_dwordData)
71 free(g_dwordData);
72 if (g_halfData)
73 free(g_halfData);
74 if (g_floatData)
75 free(g_floatData);
76 if (g_doubleData)
77 free(g_doubleData);
78
79 g_byteData = (CMP_BYTE*)calloc(numValues, sizeof(CMP_BYTE));
80 g_sbyteData = (CMP_SBYTE*)calloc(numValues, sizeof(CMP_SBYTE));
81 g_wordData = (CMP_WORD*)calloc(numValues, sizeof(CMP_WORD));
82 g_dwordData = (CMP_DWORD*)calloc(numValues, sizeof(CMP_DWORD));
83 g_halfData = (CMP_HALF*)calloc(numValues, sizeof(CMP_HALF));
84 g_floatData = (float*)calloc(numValues, sizeof(float));
85 g_doubleData = (double*)calloc(numValues, sizeof(double));
86
87 g_dataLength = numValues;
88
89 for (unsigned int i = 0; i < numValues; ++i)
90 {
91 g_byteData[i] = i;
92 g_sbyteData[i] = i;
93 g_wordData[i] = i;
94 g_dwordData[i] = i;
95 }
96
97 SetFloatData(isSigned);
98}
99
100template <typename T>
101static T* GetSrcDataOfType()

Callers 1

Calls 1

SetFloatDataFunction · 0.85

Tested by

no test coverage detected