Skip to content

Commit

Permalink
librishka implementations: calloc(), realloc(), and free().
Browse files Browse the repository at this point in the history
  • Loading branch information
nthnn committed Feb 23, 2024
1 parent 461951a commit c80a2c4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions sdk/librishka_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,18 @@ void Memory::alloc(any dest, usize size) {
rishka_sc_2(RISHKA_SC_MEM_ALLOC, (i64) dest, (i64) size);
}

void Memory::calloc(any dest, usize num, usize size) {
rishka_sc_3(RISHKA_SC_MEM_CALLOC, (i64) dest, (i64) num, (i64) size);
}

void Memory::realloc(any dest, any ptr, usize size) {
rishka_sc_3(RISHKA_SC_MEM_REALLOC, (i64) dest, (i64) ptr, (i64) size);
}

void Memory::free(any ptr) {
rishka_sc_1(RISHKA_SC_MEM_FREE, (i64) ptr);
}

any Memory::set(void* dest, i32 c, u32 n) {
return (any) rishka_sc_3(RISHKA_SC_MEM_SET, (i64) dest, (i64) c, (i64) n);
}

0 comments on commit c80a2c4

Please sign in to comment.