The structure 't' is overlapping if at least one memory location is visited twice while iterating through all possible tuples of indices.
(t)
| 480 | return p |
| 481 | |
| 482 | def is_overlapping(t): |
| 483 | """The structure 't' is overlapping if at least one memory location |
| 484 | is visited twice while iterating through all possible tuples of |
| 485 | indices.""" |
| 486 | memlen, itemsize, ndim, shape, strides, offset = t |
| 487 | visited = 1<<memlen |
| 488 | for ind in indices(shape): |
| 489 | i = memory_index(ind, t) |
| 490 | bit = 1<<i |
| 491 | if visited & bit: |
| 492 | return True |
| 493 | visited |= bit |
| 494 | return False |
| 495 | |
| 496 | def rand_structure(itemsize, valid, maxdim=5, maxshape=16, shape=()): |
| 497 | """Return random structure: |
no test coverage detected