update
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
#include <iostream>
|
||||
#include <ostream>
|
||||
#include <unistd.h> // TODO(djledda): get outta here
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#define STB_SPRINTF_IMPLEMENTATION
|
||||
#include "core.h"
|
||||
#include "os.cpp"
|
||||
#define STB_SPRINTF_IMPLEMENTATION
|
||||
#include "vendor/stb_sprintf.h"
|
||||
|
||||
void *pushSize(Arena *arena, size_t bytes) {
|
||||
if (arena->capacity - arena->head >= bytes) {
|
||||
@@ -30,6 +33,10 @@ void arenaFreeFrom(Arena *arena, size_t position) {
|
||||
arena->head = position;
|
||||
}
|
||||
|
||||
void arenaPopTo(Arena *arena, void *position) {
|
||||
arena->head = (byte *)position - (byte *)arena->memory;
|
||||
}
|
||||
|
||||
Arena *scratchArenas[2];
|
||||
|
||||
void initialiseCore() {
|
||||
|
||||
@@ -60,6 +60,7 @@ void *pushSize(Arena *arena, size_t bytes);
|
||||
Arena *arenaAlloc(size_t capacity);
|
||||
void arenaFree(Arena *arena);
|
||||
void arenaFreeFrom(Arena *arena, size_t pos);
|
||||
void arenaPopTo(Arena *arena, void *pos);
|
||||
|
||||
void initialiseCore();
|
||||
|
||||
@@ -209,8 +210,8 @@ void log(const char *fmt, ...);
|
||||
void logError(const char *fmt, ...);
|
||||
|
||||
// ### Loops ###
|
||||
#define EachIn(list, it) size_t it = 0; it < list.length; it++
|
||||
#define EachInReversed(list, it) size_t it = list.length - 1; it >= 0 && it < list.length; it--
|
||||
#define EachIn(list, it) size_t it = 0; it < (list).length; it++
|
||||
#define EachInReversed(list, it) size_t it = (list).length - 1; it >= 0 && it < (list).length; it--
|
||||
#define EachInArray(arr, it) size_t it = 0; it < ArrayCount(arr); ++it
|
||||
|
||||
// ### Misc ###
|
||||
|
||||
Reference in New Issue
Block a user