MCPcopy Create free account
hub / github.com/Simple-XX/SimpleKernel / IoBuffer

Method IoBuffer

src/io_buffer.cpp:12–21  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10#include "sk_stdlib.h"
11
12IoBuffer::IoBuffer(size_t size, size_t alignment) {
13 assert(size > 0 && "IoBuffer size must be greater than 0");
14 assert((alignment & (alignment - 1)) == 0 &&
15 "IoBuffer alignment must be a power of 2");
16
17 auto* data = static_cast<uint8_t*>(aligned_alloc(alignment, size));
18 assert(data != nullptr && "IoBuffer aligned_alloc failed");
19 data_ = data;
20 size_ = size;
21}
22
23IoBuffer::~IoBuffer() {
24 assert((data_ == nullptr) == (size_ == 0) &&

Callers

nothing calls this directly

Calls 1

aligned_allocFunction · 0.50

Tested by

no test coverage detected