diff options
Diffstat (limited to 'lib/untyped.c')
-rw-r--r-- | lib/untyped.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/untyped.c b/lib/untyped.c new file mode 100644 index 0000000..8a20f63 --- /dev/null +++ b/lib/untyped.c @@ -0,0 +1,16 @@ +#include "include/object.h" +#include "error.h" + +int +ko_untyped_split(objdir_entry_t *target, objdir_entry_t *dest, size_t bytes) +{ + size_t *untyped = ko_entry_data(target); + if(*untyped <= bytes) return KE_TOOSMALL; + + *untyped -= bytes; + dest->data = target->data + *untyped; + *(size_t*)ko_entry_data(dest) = bytes; + dest->type = KO_MEMORY_UNTYPED; + + return 0; +} |