MCPcopy Create free account
hub / github.com/KhronosGroup/OpenCL-CTS / create_linked_lists

Function create_linked_lists

test_conformance/SVM/main.cpp:116–135  ·  view source on GitHub ↗

The first N nodes in pNodes will be the heads of the lists.

Source from the content-addressed store, hash-verified

114
115// The first N nodes in pNodes will be the heads of the lists.
116void create_linked_lists(Node* pNodes, size_t num_lists, int list_length)
117{
118 size_t allocation_index = num_lists; // heads of lists are in first num_lists nodes.
119
120 for(cl_uint i = 0; i < num_lists; i++)
121 {
122 Node *pNode = &pNodes[i];
123 pNode->global_id = i;
124 pNode->position_in_list = 0;
125 Node *pNew;
126 for(int j=1; j < list_length; j++)
127 {
128 pNew = &pNodes[ allocation_index++ ];// allocate a new node
129 pNew->global_id = i;
130 pNew->position_in_list = j;
131 pNode->pNext = pNew; // link new node onto end of list
132 pNode = pNew; // move to end of list
133 }
134 }
135}
136
137cl_int verify_linked_lists(Node* pNodes, size_t num_lists, int list_length)
138{

Callers 5

REGISTER_TESTFunction · 0.85
REGISTER_TESTFunction · 0.85

Calls

no outgoing calls

Tested by 5

REGISTER_TESTFunction · 0.68
REGISTER_TESTFunction · 0.68