Change boolean size to 1 byte

This commit is contained in:
2025-12-07 12:17:40 +00:00
parent 432e4a48d5
commit 9c5b95c229
41 changed files with 489 additions and 364 deletions

View File

@@ -123,7 +123,7 @@ void wapp_str8_push_back(Str8 *str, c8 c) {
wapp_str8_set(str, index, c);
}
b32 wapp_str8_equal(Str8RO *s1, Str8RO *s2) {
b8 wapp_str8_equal(Str8RO *s1, Str8RO *s2) {
if (s1->size != s2->size) {
return false;
}
@@ -131,7 +131,7 @@ b32 wapp_str8_equal(Str8RO *s1, Str8RO *s2) {
return wapp_str8_equal_to_count(s1, s2, s1->size);
}
b32 wapp_str8_equal_to_count(Str8RO* s1, Str8RO* s2, u64 count) {
b8 wapp_str8_equal_to_count(Str8RO* s1, Str8RO* s2, u64 count) {
if (!s1 || !s2) {
return false;
}
@@ -278,7 +278,7 @@ i64 wapp_str8_find(Str8RO *str, Str8RO substr) {
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
// MSVC Spectre mitigation warnings
u64 char_index = 0;
b32 running = char_index < str->size;
b8 running = char_index < str->size;
while (running) {
const c8 *sub = str->buf + char_index;
if (memcmp(sub, substr.buf, substr.size) == 0) {
@@ -300,7 +300,7 @@ i64 wapp_str8_rfind(Str8RO *str, Str8RO substr) {
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
// MSVC Spectre mitigation warnings
i64 char_index = str->size - substr.size;
b32 running = char_index >= 0;
b8 running = char_index >= 0;
while (running) {
const c8 *sub = str->buf + char_index;
if (memcmp(sub, substr.buf, substr.size) == 0) {
@@ -427,7 +427,7 @@ Str8 *wapp_str8_join(const Allocator *allocator, const Str8List *list, Str8RO *d
// MSVC Spectre mitigation warnings
Str8Node *node;
u64 node_index = 0;
b32 running = node_index < list->node_count;
b8 running = node_index < list->node_count;
while (running) {
node = wapp_str8_list_get(list, node_index);
if (!node) {
@@ -438,7 +438,7 @@ Str8 *wapp_str8_join(const Allocator *allocator, const Str8List *list, Str8RO *d
// NOTE (Abdelrahman): Comparison extracted to variable to silence
// MSVC Spectre mitigation warnings
b32 not_last = node_index + 1 < list->node_count;
b8 not_last = node_index + 1 < list->node_count;
if (not_last) {
wapp_str8_concat_capped(output, delimiter);
}
@@ -460,7 +460,7 @@ u64 wapp_str8_list_total_size(const Str8List *list) {
Str8Node* node;
u64 node_index = 0;
u64 output = 0;
b32 running = node_index < list->node_count;
b8 running = node_index < list->node_count;
while (running) {
node = wapp_str8_list_get(list, node_index);
if (!node) {