added network builtins and fixed a bug in OPCODE_SELECT

This commit is contained in:
cozis
2021-12-04 12:36:47 +01:00
parent 3b6e631a5b
commit 4cf95336e8
7 changed files with 265 additions and 13 deletions
+4 -1
View File
@@ -1,4 +1,5 @@
#include <assert.h>
#include <string.h>
#include "../utils/defs.h"
#include "objects.h"
@@ -40,6 +41,8 @@ Object *Object_NewBuffer(int size, Heap *heap, Error *error)
if(obj->body == NULL)
return NULL;
memset(obj->body, 0, size);
}
return (Object*) obj;
@@ -71,7 +74,7 @@ static Object *select(Object *self, Object *key, Heap *heap, Error *error)
}
unsigned char byte = buffer->body[idx];
return Object_FromInt(byte, heap, error);
}