summaryrefslogtreecommitdiff
path: root/src/libultra/audio/heapalloc.c
blob: 708134ec2b0558f4226fea6e4035803a5e89de24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "libaudio.h"
#include "synthInternals.h"
#include "stddef.h"

void* alHeapDBAlloc(u8* file, s32 line, ALHeap* hp, s32 num, s32 size) {
    s32 bytes;
    u8* ptr = NULL;

    bytes = (num * size + AL_CACHE_ALIGN) & ~AL_CACHE_ALIGN;

    if (hp->cur + bytes <= hp->base + hp->len) {
        ptr = hp->cur;
        hp->cur += bytes;
    }
    return ptr;
}