Replace bool, true and false with aliases
This commit is contained in:
@@ -5,11 +5,11 @@
|
||||
#ifndef ARRAY_H
|
||||
#define ARRAY_H
|
||||
|
||||
#include "../../common/aliases/aliases.h"
|
||||
#include "../mem_allocator/mem_allocator.h"
|
||||
#include "../../common/misc/misc_utils.h"
|
||||
#include "../../common/aliases/aliases.h"
|
||||
#include "../../common/platform/platform.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
#define wapp_str8_array(...) ((Str8Array){ \
|
||||
.items = (Str8[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(Str8, __VA_ARGS__) * 2)]){__VA_ARGS__}, \
|
||||
@@ -35,17 +35,17 @@
|
||||
*_void_ptr_array_pop(ARRAY_PTR) : \
|
||||
(void *){0} \
|
||||
)
|
||||
#define wapp_bool_array(...) ((BoolArray){ \
|
||||
.items = (bool[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(bool, __VA_ARGS__) * 2)]){__VA_ARGS__}, \
|
||||
.count = wapp_misc_utils_va_args_count(bool, __VA_ARGS__), \
|
||||
.capacity = wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(bool, __VA_ARGS__) * 2), \
|
||||
.item_size = sizeof(bool) \
|
||||
#define wapp_b32_array(...) ((B32Array){ \
|
||||
.items = (b32[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(b32, __VA_ARGS__) * 2)]){__VA_ARGS__}, \
|
||||
.count = wapp_misc_utils_va_args_count(b32, __VA_ARGS__), \
|
||||
.capacity = wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(b32, __VA_ARGS__) * 2), \
|
||||
.item_size = sizeof(b32) \
|
||||
})
|
||||
#define wapp_bool_array_with_capacity(CAPACITY) ((BoolArray){.items = (bool[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(bool)})
|
||||
#define wapp_bool_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((BoolArray *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(bool)))
|
||||
#define wapp_bool_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
|
||||
*_bool_array_pop(ARRAY_PTR) : \
|
||||
(bool){0} \
|
||||
#define wapp_b32_array_with_capacity(CAPACITY) ((B32Array){.items = (b32[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(b32)})
|
||||
#define wapp_b32_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((B32Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(b32)))
|
||||
#define wapp_b32_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
|
||||
*_b32_array_pop(ARRAY_PTR) : \
|
||||
(b32){0} \
|
||||
)
|
||||
#define wapp_char_array(...) ((CharArray){ \
|
||||
.items = (char[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(char, __VA_ARGS__) * 2)]){__VA_ARGS__}, \
|
||||
@@ -270,9 +270,9 @@ struct VoidPArray {
|
||||
u64 item_size;
|
||||
};
|
||||
|
||||
typedef struct BoolArray BoolArray;
|
||||
struct BoolArray {
|
||||
bool *items;
|
||||
typedef struct B32Array B32Array;
|
||||
struct B32Array {
|
||||
b32 *items;
|
||||
u64 count;
|
||||
u64 capacity;
|
||||
u64 item_size;
|
||||
@@ -434,16 +434,16 @@ VoidPArray *wapp_void_ptr_array_append_alloc(const Allocator *allocator, VoidPAr
|
||||
VoidPArray *wapp_void_ptr_array_extend_alloc(const Allocator *allocator, VoidPArray *array, const VoidPArray *other);
|
||||
VoidPArray *wapp_void_ptr_array_copy_alloc(const Allocator *allocator, const VoidPArray *src, VoidPArray *dst);
|
||||
void * *_void_ptr_array_pop(VoidPArray *array);
|
||||
bool *wapp_bool_array_get(const BoolArray *array, u64 index);
|
||||
void wapp_bool_array_set(BoolArray *array, u64 index, bool *item);
|
||||
void wapp_bool_array_append_capped(BoolArray *array, bool *item);
|
||||
void wapp_bool_array_extend_capped(BoolArray *array, const BoolArray *other);
|
||||
void wapp_bool_array_clear(BoolArray *array);
|
||||
void wapp_bool_array_copy_capped(const BoolArray *src, BoolArray *dst);
|
||||
BoolArray *wapp_bool_array_append_alloc(const Allocator *allocator, BoolArray *array, bool *item);
|
||||
BoolArray *wapp_bool_array_extend_alloc(const Allocator *allocator, BoolArray *array, const BoolArray *other);
|
||||
BoolArray *wapp_bool_array_copy_alloc(const Allocator *allocator, const BoolArray *src, BoolArray *dst);
|
||||
bool *_bool_array_pop(BoolArray *array);
|
||||
b32 *wapp_b32_array_get(const B32Array *array, u64 index);
|
||||
void wapp_b32_array_set(B32Array *array, u64 index, b32 *item);
|
||||
void wapp_b32_array_append_capped(B32Array *array, b32 *item);
|
||||
void wapp_b32_array_extend_capped(B32Array *array, const B32Array *other);
|
||||
void wapp_b32_array_clear(B32Array *array);
|
||||
void wapp_b32_array_copy_capped(const B32Array *src, B32Array *dst);
|
||||
B32Array *wapp_b32_array_append_alloc(const Allocator *allocator, B32Array *array, b32 *item);
|
||||
B32Array *wapp_b32_array_extend_alloc(const Allocator *allocator, B32Array *array, const B32Array *other);
|
||||
B32Array *wapp_b32_array_copy_alloc(const Allocator *allocator, const B32Array *src, B32Array *dst);
|
||||
b32 *_b32_array_pop(B32Array *array);
|
||||
char *wapp_char_array_get(const CharArray *array, u64 index);
|
||||
void wapp_char_array_set(CharArray *array, u64 index, char *item);
|
||||
void wapp_char_array_append_capped(CharArray *array, char *item);
|
||||
|
Reference in New Issue
Block a user