MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / MemoryRegion

Method MemoryRegion

arm_compute/runtime/MemoryRegion.h:48–65  ·  view source on GitHub ↗

Constructor * * @param[in] size Region size * @param[in] alignment Alignment in bytes of the base pointer. Defaults to 0 */

Source from the content-addressed store, hash-verified

46 * @param[in] alignment Alignment in bytes of the base pointer. Defaults to 0
47 */
48 MemoryRegion(size_t size, size_t alignment = 0) : IMemoryRegion(size), _mem(nullptr), _ptr(nullptr)
49 {
50 if (size != 0)
51 {
52 // Allocate backing memory
53 size_t space = size + alignment;
54 _mem = std::shared_ptr<uint8_t>(new uint8_t[space](), [](uint8_t *ptr) { delete[] ptr; });
55 _ptr = _mem.get();
56
57 // Calculate alignment offset
58 if (alignment != 0)
59 {
60 void *aligned_ptr = _mem.get();
61 std::align(alignment, size, aligned_ptr, space);
62 _ptr = aligned_ptr;
63 }
64 }
65 }
66 MemoryRegion(void *ptr, size_t size) : IMemoryRegion(size), _mem(nullptr), _ptr(nullptr)
67 {
68 if (size != 0)

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected