Some light header pruning

This commit is contained in:
2024-06-17 23:11:30 +01:00
parent a60108ae1d
commit 66153afbde
4 changed files with 1 additions and 10 deletions

View File

@@ -54,7 +54,6 @@ void darr_append_bytes(darr_t *darr, byte_t *bytes, size_t n)
byte_t *darr_at(darr_t *darr, size_t index) byte_t *darr_at(darr_t *darr, size_t index)
{ {
if (index >= darr->used) if (index >= darr->used)
// TODO: Error (index is out of bounds)
return NULL; return NULL;
return darr->data + index; return darr->data + index;
} }

View File

@@ -12,10 +12,7 @@
#include <assert.h> #include <assert.h>
#include <inttypes.h> #include <inttypes.h>
#include <math.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "./runtime.h" #include "./runtime.h"

View File

@@ -13,12 +13,8 @@
#ifndef RUNTIME_H #ifndef RUNTIME_H
#define RUNTIME_H #define RUNTIME_H
#include <stdio.h>
#include <stdlib.h>
#include <lib/inst.h> #include <lib/inst.h>
#include "./runtime.h"
#include "./struct.h" #include "./struct.h"
typedef enum typedef enum

View File

@@ -10,7 +10,6 @@
* Description: Virtual machine data structures and some helpers * Description: Virtual machine data structures and some helpers
*/ */
#include <math.h>
#include <stdio.h> #include <stdio.h>
#include "./struct.h" #include "./struct.h"
@@ -118,7 +117,7 @@ void vm_print_registers(vm_t *vm, FILE *fp)
vm->registers.available / HWORD_SIZE, vm->registers.available / HWORD_SIZE,
vm->registers.available / WORD_SIZE); vm->registers.available / WORD_SIZE);
fprintf(fp, "Registers.reg = ["); fprintf(fp, "Registers.reg = [");
for (size_t i = 0; i < ceil((long double)reg.used / WORD_SIZE); ++i) for (size_t i = 0; i < (reg.used / WORD_SIZE); ++i)
{ {
fprintf(fp, "{%lu:%lX}", i, VM_NTH_REGISTER(reg, i)); fprintf(fp, "{%lu:%lX}", i, VM_NTH_REGISTER(reg, i));
if (i != reg.used - 1) if (i != reg.used - 1)