MCPcopy Create free account
hub / github.com/QuEST-Kit/QuEST / isIndexListUnique

Function isIndexListUnique

quest/src/core/validation.cpp:1354–1373  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1352}
1353
1354bool isIndexListUnique(int* list, int len) {
1355
1356 // use a max-size bitmask (64 bits)
1357 long long unsigned int mask = 0;
1358 int numBits = sizeof(mask) * 8;
1359
1360 // check internal safety
1361 for (int i=0; i<len; i++)
1362 if (list[i] >= numBits)
1363 error_validationListUniquenessCheckExceededMaskSize();
1364
1365 // write encountered elements to a bitmask
1366 for (int i=0; i<len; i++)
1367 if (1 & (mask >> list[i]))
1368 return false;
1369 else
1370 mask |= 1ULL << list[i];
1371
1372 return true;
1373}
1374
1375bool doQuregsHaveIdenticalMemoryLayouts(Qureg a, Qureg b) {
1376

Callers 1

Tested by

no test coverage detected