update
This commit is contained in:
@@ -1,11 +1,20 @@
|
||||
#include "os.cpp"
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "core.h"
|
||||
#include "os.cpp"
|
||||
#define STB_SPRINTF_IMPLEMENTATION
|
||||
#include "vendor/stb_sprintf.h"
|
||||
|
||||
void *pushSizeFill(Arena *arena, size_t bytes, byte fill) {
|
||||
if (arena->capacity - arena->head >= bytes) {
|
||||
void *ptr = (char *)arena->memory + arena->head;
|
||||
arena->head += bytes;
|
||||
memset(ptr, fill, bytes);
|
||||
return ptr;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *pushSize(Arena *arena, size_t bytes) {
|
||||
if (arena->capacity - arena->head >= bytes) {
|
||||
void *ptr = (char *)arena->memory + arena->head;
|
||||
@@ -112,6 +121,18 @@ const char *cstring(Arena *arena, string str) {
|
||||
return arr;
|
||||
}
|
||||
|
||||
bool strStartsWith(string str, string testStr) {
|
||||
if (str.length < testStr.length) {
|
||||
return false;
|
||||
}
|
||||
for (size_t i = 0; i < testStr.length; i++) {
|
||||
if (str.str[i] != testStr.str[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool strEql(string s1, string s2) {
|
||||
if (s1.length != s2.length) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user