MCPcopy Create free account
hub / github.com/RenderKit/oidn / overlaps

Method overlaps

core/image.cpp:83–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81 }
82
83 bool Image::overlaps(const Image& other) const
84 {
85 if (!*this || !other)
86 return false;
87
88 // If any of the images are not backed by non-shared buffers, we cannot determine whether they
89 // overlap due to potential virtual address aliasing, so we conservatively assume they do
90 if (!buffer || buffer->isShared() || !other.buffer || other.buffer->isShared())
91 return true;
92
93 // If the images are backed by different non-shared buffers, they cannot overlap
94 if (buffer != other.buffer)
95 return false;
96
97 // Check whether the memory ranges inside the same buffer overlap
98 const char* begin1 = ptr;
99 const char* end1 = ptr + getByteSize();
100 const char* begin2 = other.ptr;
101 const char* end2 = other.ptr + other.getByteSize();
102
103 return begin1 < end2 && begin2 < end1;
104 }
105
106OIDN_NAMESPACE_END

Callers 1

commitMethod · 0.80

Calls 3

isSharedMethod · 0.80
getByteSizeFunction · 0.70
getByteSizeMethod · 0.45

Tested by

no test coverage detected