| 1352 | } |
| 1353 | |
| 1354 | bool 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 | |
| 1375 | bool doQuregsHaveIdenticalMemoryLayouts(Qureg a, Qureg b) { |
| 1376 |
no test coverage detected