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

@@ -21,14 +21,14 @@ struct arena {
u8 *buf;
u8 *offset;
u64 capacity;
b32 committed;
b8 committed;
#ifdef WAPP_PLATFORM_WINDOWS
wapp_misc_utils_padding_size(sizeof(u8 *) * 2 + sizeof(u64) + sizeof(b32));
wapp_misc_utils_padding_size(sizeof(u8 *) * 2 + sizeof(u64) + sizeof(b8));
#endif // ifdef WAPP_PLATFORM_WINDOWS
};
b32 wapp_mem_arena_init_custom(Arena **arena, u64 base_capacity, MemAllocFlags flags, b32 zero_buffer) {
b8 wapp_mem_arena_init_custom(Arena **arena, u64 base_capacity, MemAllocFlags flags, b8 zero_buffer) {
if (!arena || *arena || base_capacity == 0) {
return false;
}

View File

@@ -27,7 +27,7 @@ typedef struct arena Arena;
* control over how the Arena is initialised. Wrapper macros are provided for
* easier use.
*/
b32 wapp_mem_arena_init_custom(Arena **arena, u64 base_capacity, MemAllocFlags flags, b32 zero_buffer);
b8 wapp_mem_arena_init_custom(Arena **arena, u64 base_capacity, MemAllocFlags flags, b8 zero_buffer);
void *wapp_mem_arena_alloc(Arena *arena, u64 size);
void *wapp_mem_arena_alloc_aligned(Arena *arena, u64 size, u64 alignment);
void *wapp_mem_arena_realloc(Arena *arena, void *ptr, u64 old_size, u64 new_size);

View File

@@ -12,9 +12,9 @@ wapp_intern inline void *mem_arena_realloc_aligned(void *ptr, u64 old_size, u64
void *alloc_obj);
Allocator wapp_mem_arena_allocator_init_custom(u64 base_capacity, MemAllocFlags flags, b32 zero_buffer) {
Allocator wapp_mem_arena_allocator_init_custom(u64 base_capacity, MemAllocFlags flags, b8 zero_buffer) {
Allocator allocator = {0};
b32 initialised = wapp_mem_arena_init_custom((Arena **)(&allocator.obj), base_capacity, flags, zero_buffer);
b8 initialised = wapp_mem_arena_init_custom((Arena **)(&allocator.obj), base_capacity, flags, zero_buffer);
if (!initialised) {
return allocator;
}

View File

@@ -32,7 +32,7 @@ BEGIN_C_LINKAGE
* The `wapp_mem_arena_allocator_init_custom` provides the most control over how
* the Arena is initialised. Wrapper macros are provided for easier use.
*/
Allocator wapp_mem_arena_allocator_init_custom(u64 base_capacity, MemAllocFlags flags, b32 zero_buffer);
Allocator wapp_mem_arena_allocator_init_custom(u64 base_capacity, MemAllocFlags flags, b8 zero_buffer);
void wapp_mem_arena_allocator_clear(Allocator *allocator);
void wapp_mem_arena_allocator_destroy(Allocator *allocator);

View File

@@ -5,7 +5,7 @@
#include "../../../common/assert/assert.h"
#include <stddef.h>
wapp_intern b32 is_power_of_two(u64 num) { return (num & (num - 1)) == 0; }
wapp_intern b8 is_power_of_two(u64 num) { return (num & (num - 1)) == 0; }
void *wapp_mem_util_align_forward(void *ptr, u64 alignment) {
wapp_debug_assert(ptr != NULL, "`ptr` should not be NULL");

View File

@@ -36,7 +36,7 @@ u32 wapp_cpath_join_path(Str8 *dst, const Str8List *parts) {
// MSVC Spectre mitigation warnings
const Str8Node *node = first_node;
u64 node_index = 1;
b32 running = node_index < parts->node_count;
b8 running = node_index < parts->node_count;
while (running && node->next) {
node = node->next;
if (node->item->size == 0) {
@@ -46,7 +46,7 @@ u32 wapp_cpath_join_path(Str8 *dst, const Str8List *parts) {
if (dst->size > 0) {
char dst_last = wapp_str8_get(dst, dst->size - 1);
char node_start = wapp_str8_get(node->item, 0);
b32 add_path_sep = dst_last != WAPP_PATH_SEP && node_start != WAPP_PATH_SEP;
b8 add_path_sep = dst_last != WAPP_PATH_SEP && node_start != WAPP_PATH_SEP;
if (add_path_sep) {
wapp_str8_concat_capped(dst, &separator);
@@ -68,7 +68,7 @@ Str8 *dirup(const Allocator *allocator, Str8RO *path, u64 levels) {
goto RETURN_DIRUP;
}
b32 absolute = wapp_str8_get(path, 0) == WAPP_PATH_SEP;
b8 absolute = wapp_str8_get(path, 0) == WAPP_PATH_SEP;
Str8 separator = wapp_str8_buf(4);
wapp_str8_push_back(&separator, WAPP_PATH_SEP);

View File

@@ -29,11 +29,11 @@ typedef struct commander_result CMDResult;
struct commander_result {
i32 exit_code;
CMDError error;
b32 exited;
b8 exited;
#ifdef WAPP_PLATFORM_WINDOWS
#include "../../../../common/misc/misc_utils.h"
wapp_misc_utils_padding_size(sizeof(b32) + sizeof(i32) + sizeof(CMDError));
wapp_misc_utils_padding_size(sizeof(b8) + sizeof(i32) + sizeof(CMDError));
#endif // !WAPP_PLATFORM_WINDOWS
};