hos/src/hello/scratch.d

20 lines
354 B
D

align(4096) __gshared ubyte[1024 * 1024] scratch;
__gshared size_t scratch_used;
size_t scratch_free()
{
return scratch.sizeof - scratch_used;
}
ubyte * scratch_current()
{
return &scratch[scratch_used];
}
ubyte * scratch_alloc(size_t n = 1)
{
ubyte * address = &scratch[scratch_used];
scratch_used += 4096u * n;
return address;
}