On 1/13/23 06:49, Gavin Ray wrote:

> I am curious if you can return something like `ubyte[PAGE_SIZE]*` or
> `ref ubyte[PAGE_SIZE]`?

A simple cast seems to work:

enum PAGE_SIZE = 4096;
enum BUF_POOL_NUM_PAGES = 1024;
alias frame_idx_t = size_t;

ubyte[10_000] data;

ubyte[PAGE_SIZE]* get_page(frame_idx_t frame_idx)
{
    auto ptr = data.ptr + frame_idx * PAGE_SIZE;
    return cast(ubyte[PAGE_SIZE]*)ptr;
}

void main() {
}

Ali

Reply via email to