MCPcopy Index your code
hub / github.com/RustPython/RustPython / is_overlapping

Function is_overlapping

Lib/test/test_buffer.py:482–494  ·  view source on GitHub ↗

The structure 't' is overlapping if at least one memory location is visited twice while iterating through all possible tuples of indices.

(t)

Source from the content-addressed store, hash-verified

480 return p
481
482def 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
496def rand_structure(itemsize, valid, maxdim=5, maxshape=16, shape=()):
497 """Return random structure:

Callers 1

Calls 2

indicesFunction · 0.85
memory_indexFunction · 0.85

Tested by

no test coverage detected