dplug.core.vec

Defines Vec, reallocBuffer and memory functions.

Members

Functions

alignedFree
void alignedFree(void* aligned, size_t alignment)

Frees aligned memory allocated by alignedMalloc or alignedRealloc. Functionally equivalent to Visual C++ _aligned_free. Do not mix allocations with different alignment.

alignedMalloc
void* alignedMalloc(size_t size, size_t alignment)

Allocates an aligned memory chunk. Functionally equivalent to Visual C++ _aligned_malloc. Do not mix allocations with different alignment.

alignedRealloc
void* alignedRealloc(void* aligned, size_t size, size_t alignment)
alignedReallocDiscard
void* alignedReallocDiscard(void* aligned, size_t size, size_t alignment)

Reallocates an aligned memory chunk allocated by alignedMalloc or alignedRealloc. Functionally equivalent to Visual C++ _aligned_realloc. Do not mix allocations with different alignment.

isMemoryOverlapping
bool isMemoryOverlapping(const(void)* a, ptrdiff_t a_size, const(void)* b, ptrdiff_t b_size)

Does memory slices a[0..a_size] and b[0..b_size] have an overlapping byte?

isMemoryOverlapping
bool isMemoryOverlapping(const(void)[] a, const(void)[] b)
Undocumented in source. Be warned that the author may not have intended to support it.
isPointerAligned
bool isPointerAligned(void* p, size_t alignment)
makeVec
Vec!T makeVec(size_t initialSize)
makeVec
deprecated Vec!T makeVec(size_t initialSize, int alignment)
Undocumented in source. Be warned that the author may not have intended to support it.
reallocBuffer
void reallocBuffer(T[] buffer, size_t length, int alignment)

Used throughout dplug:dsp to avoid reliance on GC. Important: Size 0 is special-case to free the slice. This works a bit like alignedRealloc except with slices as input. You MUST use consistent alignement thoughout the lifetime of this buffer.

Structs

MergedAllocation
struct MergedAllocation

Allows to merge the allocation of several arrays, which saves allocation count and can speed up things thanks to locality.

Vec
struct Vec(T)

Kind of a std::vector replacement. Grow-only array, points to a (optionally aligned) memory location. This can also work as an output range. Vec is designed to work even when uninitialized, without makeVec. Warning: it is pretty barebones, doesn't respect T.init or call destructors. When used in a GC program, GC roots won't be registered.

Meta

Authors

Guillaume Piolat