1
0
mirror of https://github.com/pevans/erc-c.git synced 2025-07-23 08:24:10 +00:00

More documentation

This commit is contained in:
Peter Evans
2017-12-06 21:37:14 -06:00
parent ea2b68dc8c
commit dccf80be5d
3 changed files with 30 additions and 6 deletions

View File

@@ -3,8 +3,22 @@
#include "vm_bits.h"
/*
* The bounds check is just some inline code to try and cut down on the
* cost of it.
*/
#define vm_segment_bounds_check(segment, index) \
(index == index % segment->size)
typedef struct {
/*
* The size of our memory segment. This is used for bounds checking.
*/
size_t size;
/*
* This is the actual chunk of memory we allocate.
*/
vm_8bit *memory;
} vm_segment;
@@ -14,7 +28,4 @@ extern void vm_segment_free(vm_segment *);
extern vm_8bit vm_segment_get(vm_segment *, size_t);
extern void vm_segment_set(vm_segment *, size_t, vm_8bit);
#define vm_segment_bounds_check(segment, index) \
(index == index % segment->size)
#endif