Update array to support C++

This commit is contained in:
Abdelrahman Said 2025-08-10 16:18:21 +01:00
parent eee4387201
commit df29d851c2
6 changed files with 433 additions and 26 deletions

View File

@ -153,7 +153,7 @@ def make_array(user_datatypes: Dict[CDataType, ArrayData] = {}):
) )
generic_funcs.append(alloc_capacity_func) generic_funcs.append(alloc_capacity_func)
stack_array_macro = CMacro( stack_array_cmacro = CMacro(
name=f"wapp_{type_string_lower}_array(...)", name=f"wapp_{type_string_lower}_array(...)",
value=__format_func_body( value=__format_func_body(
filename=snippets_dir / "stack_array", filename=snippets_dir / "stack_array",
@ -163,8 +163,18 @@ def make_array(user_datatypes: Dict[CDataType, ArrayData] = {}):
array_typename=array_data.array_typename, array_typename=array_data.array_typename,
), ),
) )
stack_array_cppmacro = CMacro(
name=f"wapp_{type_string_lower}_array(...)",
value=__format_func_body(
filename=snippets_dir / "stack_array_cpp",
type_string=type_string,
type_string_upper=type_string_upper,
type_string_lower=type_string_lower,
array_typename=array_data.array_typename,
),
)
stack_capacity_array_macro = CMacro( stack_capacity_array_cmacro = CMacro(
name=f"wapp_{type_string_lower}_array_with_capacity(CAPACITY)", name=f"wapp_{type_string_lower}_array_with_capacity(CAPACITY)",
value=__format_func_body( value=__format_func_body(
filename=snippets_dir / "stack_capacity_array", filename=snippets_dir / "stack_capacity_array",
@ -174,6 +184,16 @@ def make_array(user_datatypes: Dict[CDataType, ArrayData] = {}):
array_typename=array_data.array_typename, array_typename=array_data.array_typename,
), ),
) )
stack_capacity_array_cppmacro = CMacro(
name=f"wapp_{type_string_lower}_array_with_capacity(CAPACITY)",
value=__format_func_body(
filename=snippets_dir / "stack_capacity_array_cpp",
type_string=type_string,
type_string_upper=type_string_upper,
type_string_lower=type_string_lower,
array_typename=array_data.array_typename,
),
)
alloc_capacity_array_macro = CMacro( alloc_capacity_array_macro = CMacro(
name=f"wapp_{type_string_lower}_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY)", name=f"wapp_{type_string_lower}_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY)",
@ -186,7 +206,7 @@ def make_array(user_datatypes: Dict[CDataType, ArrayData] = {}):
), ),
) )
array_pop_macro = CMacro( array_pop_cmacro = CMacro(
name=f"wapp_{type_string_lower}_array_pop(ARRAY_PTR)", name=f"wapp_{type_string_lower}_array_pop(ARRAY_PTR)",
value=__format_func_body( value=__format_func_body(
filename=snippets_dir / "array_pop_macro", filename=snippets_dir / "array_pop_macro",
@ -196,6 +216,16 @@ def make_array(user_datatypes: Dict[CDataType, ArrayData] = {}):
array_typename=array_data.array_typename, array_typename=array_data.array_typename,
), ),
) )
array_pop_cppmacro = CMacro(
name=f"wapp_{type_string_lower}_array_pop(ARRAY_PTR)",
value=__format_func_body(
filename=snippets_dir / "array_pop_macro_cpp",
type_string=type_string,
type_string_upper=type_string_upper,
type_string_lower=type_string_lower,
array_typename=array_data.array_typename,
),
)
get_func = CFunc( get_func = CFunc(
name=f"wapp_{type_string_lower}_array_get", name=f"wapp_{type_string_lower}_array_get",
@ -366,10 +396,17 @@ def make_array(user_datatypes: Dict[CDataType, ArrayData] = {}):
header.decl_types.extend(array_data.hdr_decl_types) header.decl_types.extend(array_data.hdr_decl_types)
header.macros.extend([ header.macros.extend([
stack_array_macro,
stack_capacity_array_macro,
alloc_capacity_array_macro, alloc_capacity_array_macro,
array_pop_macro, ])
header.c_macros.extend([
stack_array_cmacro,
stack_capacity_array_cmacro,
array_pop_cmacro,
])
header.cpp_macros.extend([
stack_array_cppmacro,
stack_capacity_array_cppmacro,
array_pop_cppmacro,
]) ])
header.types.extend([array]) header.types.extend([array])
header.funcs.extend([ header.funcs.extend([

View File

@ -0,0 +1,4 @@
(ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_{Tlower}_array_pop(ARRAY_PTR) : \
{T}{{}} \
)

View File

@ -0,0 +1,9 @@
([]() {{ \
persistent {T} buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count({T}, __VA_ARGS__) * 2)] = {{__VA_ARGS__}}; \
return {ArrayType}{{ \
buf, \
wapp_misc_utils_va_args_count({T}, __VA_ARGS__), \
wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count({T}, __VA_ARGS__) * 2), \
sizeof({T}) \
}}; \
}}())

View File

@ -0,0 +1,4 @@
([]() {{ \
persistent {T} buf[CAPACITY] = {{}}; \
return {ArrayType}{{buf, 0, CAPACITY, sizeof({T})}}; \
}}())

View File

@ -38,10 +38,19 @@ BEGIN_C_LINKAGE
) + 1 \ ) + 1 \
) )
#ifdef WAPP_PLATFORM_CPP
#define wapp_misc_utils_va_args_count(T, ...) va_args_count<T>(__VA_ARGS__)
#else
#define wapp_misc_utils_va_args_count(T, ...) (sizeof((T[]){__VA_ARGS__})/sizeof(T)) #define wapp_misc_utils_va_args_count(T, ...) (sizeof((T[]){__VA_ARGS__})/sizeof(T))
#endif // !WAPP_PLATFORM_CPP
#ifdef WAPP_PLATFORM_CPP #ifdef WAPP_PLATFORM_CPP
END_C_LINKAGE END_C_LINKAGE
template <typename T, typename... Args>
constexpr u64 va_args_count(Args&&...) {
return sizeof...(Args);
}
#endif // !WAPP_PLATFORM_CPP #endif // !WAPP_PLATFORM_CPP
#endif // !MISC_UTILS_H #endif // !MISC_UTILS_H

View File

@ -15,6 +15,369 @@
BEGIN_C_LINKAGE BEGIN_C_LINKAGE
#endif // !WAPP_PLATFORM_CPP #endif // !WAPP_PLATFORM_CPP
#define wapp_str8_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((Str8Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(Str8)))
#define wapp_void_ptr_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((VoidPArray *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(void *)))
#define wapp_b32_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((B32Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(b32)))
#define wapp_char_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((CharArray *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(char)))
#define wapp_c8_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((C8Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(c8)))
#define wapp_c16_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((C16Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(c16)))
#define wapp_c32_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((C32Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(c32)))
#define wapp_i8_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((I8Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(i8)))
#define wapp_i16_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((I16Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(i16)))
#define wapp_i32_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((I32Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(i32)))
#define wapp_i64_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((I64Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(i64)))
#define wapp_u8_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((U8Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(u8)))
#define wapp_u16_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((U16Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(u16)))
#define wapp_u32_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((U32Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(u32)))
#define wapp_u64_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((U64Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(u64)))
#define wapp_f32_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((F32Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(f32)))
#define wapp_f64_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((F64Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(f64)))
#define wapp_f128_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((F128Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(f128)))
#define wapp_iptr_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((IptrArray *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(iptr)))
#define wapp_uptr_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((UptrArray *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(uptr)))
#ifdef WAPP_PLATFORM_CPP
#define wapp_str8_array(...) ([]() { \
persistent Str8 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(Str8, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
return Str8Array{ \
buf, \
wapp_misc_utils_va_args_count(Str8, __VA_ARGS__), \
wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(Str8, __VA_ARGS__) * 2), \
sizeof(Str8) \
}; \
}())
#define wapp_str8_array_with_capacity(CAPACITY) ([]() { \
persistent Str8 buf[CAPACITY] = {}; \
return Str8Array{buf, 0, CAPACITY, sizeof(Str8)}; \
}())
#define wapp_str8_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_str8_array_pop(ARRAY_PTR) : \
Str8{} \
)
#define wapp_void_ptr_array(...) ([]() { \
persistent void * buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(void *, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
return VoidPArray{ \
buf, \
wapp_misc_utils_va_args_count(void *, __VA_ARGS__), \
wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(void *, __VA_ARGS__) * 2), \
sizeof(void *) \
}; \
}())
#define wapp_void_ptr_array_with_capacity(CAPACITY) ([]() { \
persistent void * buf[CAPACITY] = {}; \
return VoidPArray{buf, 0, CAPACITY, sizeof(void *)}; \
}())
#define wapp_void_ptr_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_void_ptr_array_pop(ARRAY_PTR) : \
void *{} \
)
#define wapp_b32_array(...) ([]() { \
persistent b32 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(b32, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
return B32Array{ \
buf, \
wapp_misc_utils_va_args_count(b32, __VA_ARGS__), \
wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(b32, __VA_ARGS__) * 2), \
sizeof(b32) \
}; \
}())
#define wapp_b32_array_with_capacity(CAPACITY) ([]() { \
persistent b32 buf[CAPACITY] = {}; \
return B32Array{buf, 0, CAPACITY, sizeof(b32)}; \
}())
#define wapp_b32_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_b32_array_pop(ARRAY_PTR) : \
b32{} \
)
#define wapp_char_array(...) ([]() { \
persistent char buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(char, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
return CharArray{ \
buf, \
wapp_misc_utils_va_args_count(char, __VA_ARGS__), \
wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(char, __VA_ARGS__) * 2), \
sizeof(char) \
}; \
}())
#define wapp_char_array_with_capacity(CAPACITY) ([]() { \
persistent char buf[CAPACITY] = {}; \
return CharArray{buf, 0, CAPACITY, sizeof(char)}; \
}())
#define wapp_char_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_char_array_pop(ARRAY_PTR) : \
char{} \
)
#define wapp_c8_array(...) ([]() { \
persistent c8 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(c8, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
return C8Array{ \
buf, \
wapp_misc_utils_va_args_count(c8, __VA_ARGS__), \
wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(c8, __VA_ARGS__) * 2), \
sizeof(c8) \
}; \
}())
#define wapp_c8_array_with_capacity(CAPACITY) ([]() { \
persistent c8 buf[CAPACITY] = {}; \
return C8Array{buf, 0, CAPACITY, sizeof(c8)}; \
}())
#define wapp_c8_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_c8_array_pop(ARRAY_PTR) : \
c8{} \
)
#define wapp_c16_array(...) ([]() { \
persistent c16 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(c16, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
return C16Array{ \
buf, \
wapp_misc_utils_va_args_count(c16, __VA_ARGS__), \
wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(c16, __VA_ARGS__) * 2), \
sizeof(c16) \
}; \
}())
#define wapp_c16_array_with_capacity(CAPACITY) ([]() { \
persistent c16 buf[CAPACITY] = {}; \
return C16Array{buf, 0, CAPACITY, sizeof(c16)}; \
}())
#define wapp_c16_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_c16_array_pop(ARRAY_PTR) : \
c16{} \
)
#define wapp_c32_array(...) ([]() { \
persistent c32 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(c32, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
return C32Array{ \
buf, \
wapp_misc_utils_va_args_count(c32, __VA_ARGS__), \
wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(c32, __VA_ARGS__) * 2), \
sizeof(c32) \
}; \
}())
#define wapp_c32_array_with_capacity(CAPACITY) ([]() { \
persistent c32 buf[CAPACITY] = {}; \
return C32Array{buf, 0, CAPACITY, sizeof(c32)}; \
}())
#define wapp_c32_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_c32_array_pop(ARRAY_PTR) : \
c32{} \
)
#define wapp_i8_array(...) ([]() { \
persistent i8 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(i8, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
return I8Array{ \
buf, \
wapp_misc_utils_va_args_count(i8, __VA_ARGS__), \
wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(i8, __VA_ARGS__) * 2), \
sizeof(i8) \
}; \
}())
#define wapp_i8_array_with_capacity(CAPACITY) ([]() { \
persistent i8 buf[CAPACITY] = {}; \
return I8Array{buf, 0, CAPACITY, sizeof(i8)}; \
}())
#define wapp_i8_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_i8_array_pop(ARRAY_PTR) : \
i8{} \
)
#define wapp_i16_array(...) ([]() { \
persistent i16 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(i16, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
return I16Array{ \
buf, \
wapp_misc_utils_va_args_count(i16, __VA_ARGS__), \
wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(i16, __VA_ARGS__) * 2), \
sizeof(i16) \
}; \
}())
#define wapp_i16_array_with_capacity(CAPACITY) ([]() { \
persistent i16 buf[CAPACITY] = {}; \
return I16Array{buf, 0, CAPACITY, sizeof(i16)}; \
}())
#define wapp_i16_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_i16_array_pop(ARRAY_PTR) : \
i16{} \
)
#define wapp_i32_array(...) ([]() { \
persistent i32 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(i32, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
return I32Array{ \
buf, \
wapp_misc_utils_va_args_count(i32, __VA_ARGS__), \
wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(i32, __VA_ARGS__) * 2), \
sizeof(i32) \
}; \
}())
#define wapp_i32_array_with_capacity(CAPACITY) ([]() { \
persistent i32 buf[CAPACITY] = {}; \
return I32Array{buf, 0, CAPACITY, sizeof(i32)}; \
}())
#define wapp_i32_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_i32_array_pop(ARRAY_PTR) : \
i32{} \
)
#define wapp_i64_array(...) ([]() { \
persistent i64 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(i64, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
return I64Array{ \
buf, \
wapp_misc_utils_va_args_count(i64, __VA_ARGS__), \
wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(i64, __VA_ARGS__) * 2), \
sizeof(i64) \
}; \
}())
#define wapp_i64_array_with_capacity(CAPACITY) ([]() { \
persistent i64 buf[CAPACITY] = {}; \
return I64Array{buf, 0, CAPACITY, sizeof(i64)}; \
}())
#define wapp_i64_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_i64_array_pop(ARRAY_PTR) : \
i64{} \
)
#define wapp_u8_array(...) ([]() { \
persistent u8 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(u8, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
return U8Array{ \
buf, \
wapp_misc_utils_va_args_count(u8, __VA_ARGS__), \
wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(u8, __VA_ARGS__) * 2), \
sizeof(u8) \
}; \
}())
#define wapp_u8_array_with_capacity(CAPACITY) ([]() { \
persistent u8 buf[CAPACITY] = {}; \
return U8Array{buf, 0, CAPACITY, sizeof(u8)}; \
}())
#define wapp_u8_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_u8_array_pop(ARRAY_PTR) : \
u8{} \
)
#define wapp_u16_array(...) ([]() { \
persistent u16 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(u16, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
return U16Array{ \
buf, \
wapp_misc_utils_va_args_count(u16, __VA_ARGS__), \
wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(u16, __VA_ARGS__) * 2), \
sizeof(u16) \
}; \
}())
#define wapp_u16_array_with_capacity(CAPACITY) ([]() { \
persistent u16 buf[CAPACITY] = {}; \
return U16Array{buf, 0, CAPACITY, sizeof(u16)}; \
}())
#define wapp_u16_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_u16_array_pop(ARRAY_PTR) : \
u16{} \
)
#define wapp_u32_array(...) ([]() { \
persistent u32 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(u32, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
return U32Array{ \
buf, \
wapp_misc_utils_va_args_count(u32, __VA_ARGS__), \
wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(u32, __VA_ARGS__) * 2), \
sizeof(u32) \
}; \
}())
#define wapp_u32_array_with_capacity(CAPACITY) ([]() { \
persistent u32 buf[CAPACITY] = {}; \
return U32Array{buf, 0, CAPACITY, sizeof(u32)}; \
}())
#define wapp_u32_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_u32_array_pop(ARRAY_PTR) : \
u32{} \
)
#define wapp_u64_array(...) ([]() { \
persistent u64 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(u64, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
return U64Array{ \
buf, \
wapp_misc_utils_va_args_count(u64, __VA_ARGS__), \
wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(u64, __VA_ARGS__) * 2), \
sizeof(u64) \
}; \
}())
#define wapp_u64_array_with_capacity(CAPACITY) ([]() { \
persistent u64 buf[CAPACITY] = {}; \
return U64Array{buf, 0, CAPACITY, sizeof(u64)}; \
}())
#define wapp_u64_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_u64_array_pop(ARRAY_PTR) : \
u64{} \
)
#define wapp_f32_array(...) ([]() { \
persistent f32 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(f32, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
return F32Array{ \
buf, \
wapp_misc_utils_va_args_count(f32, __VA_ARGS__), \
wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(f32, __VA_ARGS__) * 2), \
sizeof(f32) \
}; \
}())
#define wapp_f32_array_with_capacity(CAPACITY) ([]() { \
persistent f32 buf[CAPACITY] = {}; \
return F32Array{buf, 0, CAPACITY, sizeof(f32)}; \
}())
#define wapp_f32_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_f32_array_pop(ARRAY_PTR) : \
f32{} \
)
#define wapp_f64_array(...) ([]() { \
persistent f64 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(f64, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
return F64Array{ \
buf, \
wapp_misc_utils_va_args_count(f64, __VA_ARGS__), \
wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(f64, __VA_ARGS__) * 2), \
sizeof(f64) \
}; \
}())
#define wapp_f64_array_with_capacity(CAPACITY) ([]() { \
persistent f64 buf[CAPACITY] = {}; \
return F64Array{buf, 0, CAPACITY, sizeof(f64)}; \
}())
#define wapp_f64_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_f64_array_pop(ARRAY_PTR) : \
f64{} \
)
#define wapp_f128_array(...) ([]() { \
persistent f128 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(f128, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
return F128Array{ \
buf, \
wapp_misc_utils_va_args_count(f128, __VA_ARGS__), \
wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(f128, __VA_ARGS__) * 2), \
sizeof(f128) \
}; \
}())
#define wapp_f128_array_with_capacity(CAPACITY) ([]() { \
persistent f128 buf[CAPACITY] = {}; \
return F128Array{buf, 0, CAPACITY, sizeof(f128)}; \
}())
#define wapp_f128_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_f128_array_pop(ARRAY_PTR) : \
f128{} \
)
#define wapp_iptr_array(...) ([]() { \
persistent iptr buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(iptr, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
return IptrArray{ \
buf, \
wapp_misc_utils_va_args_count(iptr, __VA_ARGS__), \
wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(iptr, __VA_ARGS__) * 2), \
sizeof(iptr) \
}; \
}())
#define wapp_iptr_array_with_capacity(CAPACITY) ([]() { \
persistent iptr buf[CAPACITY] = {}; \
return IptrArray{buf, 0, CAPACITY, sizeof(iptr)}; \
}())
#define wapp_iptr_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_iptr_array_pop(ARRAY_PTR) : \
iptr{} \
)
#define wapp_uptr_array(...) ([]() { \
persistent uptr buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(uptr, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
return UptrArray{ \
buf, \
wapp_misc_utils_va_args_count(uptr, __VA_ARGS__), \
wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(uptr, __VA_ARGS__) * 2), \
sizeof(uptr) \
}; \
}())
#define wapp_uptr_array_with_capacity(CAPACITY) ([]() { \
persistent uptr buf[CAPACITY] = {}; \
return UptrArray{buf, 0, CAPACITY, sizeof(uptr)}; \
}())
#define wapp_uptr_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_uptr_array_pop(ARRAY_PTR) : \
uptr{} \
)
#else
#define wapp_str8_array(...) ((Str8Array){ \ #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__}, \ .items = (Str8[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(Str8, __VA_ARGS__) * 2)]){__VA_ARGS__}, \
.count = wapp_misc_utils_va_args_count(Str8, __VA_ARGS__), \ .count = wapp_misc_utils_va_args_count(Str8, __VA_ARGS__), \
@ -22,7 +385,6 @@ BEGIN_C_LINKAGE
.item_size = sizeof(Str8) \ .item_size = sizeof(Str8) \
}) })
#define wapp_str8_array_with_capacity(CAPACITY) ((Str8Array){.items = (Str8[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(Str8)}) #define wapp_str8_array_with_capacity(CAPACITY) ((Str8Array){.items = (Str8[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(Str8)})
#define wapp_str8_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((Str8Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(Str8)))
#define wapp_str8_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \ #define wapp_str8_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_str8_array_pop(ARRAY_PTR) : \ *_str8_array_pop(ARRAY_PTR) : \
(Str8){0} \ (Str8){0} \
@ -34,7 +396,6 @@ BEGIN_C_LINKAGE
.item_size = sizeof(void *) \ .item_size = sizeof(void *) \
}) })
#define wapp_void_ptr_array_with_capacity(CAPACITY) ((VoidPArray){.items = (void *[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(void *)}) #define wapp_void_ptr_array_with_capacity(CAPACITY) ((VoidPArray){.items = (void *[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(void *)})
#define wapp_void_ptr_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((VoidPArray *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(void *)))
#define wapp_void_ptr_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \ #define wapp_void_ptr_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_void_ptr_array_pop(ARRAY_PTR) : \ *_void_ptr_array_pop(ARRAY_PTR) : \
(void *){0} \ (void *){0} \
@ -46,7 +407,6 @@ BEGIN_C_LINKAGE
.item_size = sizeof(b32) \ .item_size = sizeof(b32) \
}) })
#define wapp_b32_array_with_capacity(CAPACITY) ((B32Array){.items = (b32[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(b32)}) #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 ? \ #define wapp_b32_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_b32_array_pop(ARRAY_PTR) : \ *_b32_array_pop(ARRAY_PTR) : \
(b32){0} \ (b32){0} \
@ -58,7 +418,6 @@ BEGIN_C_LINKAGE
.item_size = sizeof(char) \ .item_size = sizeof(char) \
}) })
#define wapp_char_array_with_capacity(CAPACITY) ((CharArray){.items = (char[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(char)}) #define wapp_char_array_with_capacity(CAPACITY) ((CharArray){.items = (char[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(char)})
#define wapp_char_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((CharArray *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(char)))
#define wapp_char_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \ #define wapp_char_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_char_array_pop(ARRAY_PTR) : \ *_char_array_pop(ARRAY_PTR) : \
(char){0} \ (char){0} \
@ -70,7 +429,6 @@ BEGIN_C_LINKAGE
.item_size = sizeof(c8) \ .item_size = sizeof(c8) \
}) })
#define wapp_c8_array_with_capacity(CAPACITY) ((C8Array){.items = (c8[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(c8)}) #define wapp_c8_array_with_capacity(CAPACITY) ((C8Array){.items = (c8[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(c8)})
#define wapp_c8_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((C8Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(c8)))
#define wapp_c8_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \ #define wapp_c8_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_c8_array_pop(ARRAY_PTR) : \ *_c8_array_pop(ARRAY_PTR) : \
(c8){0} \ (c8){0} \
@ -82,7 +440,6 @@ BEGIN_C_LINKAGE
.item_size = sizeof(c16) \ .item_size = sizeof(c16) \
}) })
#define wapp_c16_array_with_capacity(CAPACITY) ((C16Array){.items = (c16[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(c16)}) #define wapp_c16_array_with_capacity(CAPACITY) ((C16Array){.items = (c16[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(c16)})
#define wapp_c16_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((C16Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(c16)))
#define wapp_c16_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \ #define wapp_c16_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_c16_array_pop(ARRAY_PTR) : \ *_c16_array_pop(ARRAY_PTR) : \
(c16){0} \ (c16){0} \
@ -94,7 +451,6 @@ BEGIN_C_LINKAGE
.item_size = sizeof(c32) \ .item_size = sizeof(c32) \
}) })
#define wapp_c32_array_with_capacity(CAPACITY) ((C32Array){.items = (c32[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(c32)}) #define wapp_c32_array_with_capacity(CAPACITY) ((C32Array){.items = (c32[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(c32)})
#define wapp_c32_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((C32Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(c32)))
#define wapp_c32_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \ #define wapp_c32_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_c32_array_pop(ARRAY_PTR) : \ *_c32_array_pop(ARRAY_PTR) : \
(c32){0} \ (c32){0} \
@ -106,7 +462,6 @@ BEGIN_C_LINKAGE
.item_size = sizeof(i8) \ .item_size = sizeof(i8) \
}) })
#define wapp_i8_array_with_capacity(CAPACITY) ((I8Array){.items = (i8[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(i8)}) #define wapp_i8_array_with_capacity(CAPACITY) ((I8Array){.items = (i8[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(i8)})
#define wapp_i8_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((I8Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(i8)))
#define wapp_i8_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \ #define wapp_i8_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_i8_array_pop(ARRAY_PTR) : \ *_i8_array_pop(ARRAY_PTR) : \
(i8){0} \ (i8){0} \
@ -118,7 +473,6 @@ BEGIN_C_LINKAGE
.item_size = sizeof(i16) \ .item_size = sizeof(i16) \
}) })
#define wapp_i16_array_with_capacity(CAPACITY) ((I16Array){.items = (i16[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(i16)}) #define wapp_i16_array_with_capacity(CAPACITY) ((I16Array){.items = (i16[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(i16)})
#define wapp_i16_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((I16Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(i16)))
#define wapp_i16_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \ #define wapp_i16_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_i16_array_pop(ARRAY_PTR) : \ *_i16_array_pop(ARRAY_PTR) : \
(i16){0} \ (i16){0} \
@ -130,7 +484,6 @@ BEGIN_C_LINKAGE
.item_size = sizeof(i32) \ .item_size = sizeof(i32) \
}) })
#define wapp_i32_array_with_capacity(CAPACITY) ((I32Array){.items = (i32[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(i32)}) #define wapp_i32_array_with_capacity(CAPACITY) ((I32Array){.items = (i32[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(i32)})
#define wapp_i32_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((I32Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(i32)))
#define wapp_i32_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \ #define wapp_i32_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_i32_array_pop(ARRAY_PTR) : \ *_i32_array_pop(ARRAY_PTR) : \
(i32){0} \ (i32){0} \
@ -142,7 +495,6 @@ BEGIN_C_LINKAGE
.item_size = sizeof(i64) \ .item_size = sizeof(i64) \
}) })
#define wapp_i64_array_with_capacity(CAPACITY) ((I64Array){.items = (i64[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(i64)}) #define wapp_i64_array_with_capacity(CAPACITY) ((I64Array){.items = (i64[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(i64)})
#define wapp_i64_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((I64Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(i64)))
#define wapp_i64_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \ #define wapp_i64_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_i64_array_pop(ARRAY_PTR) : \ *_i64_array_pop(ARRAY_PTR) : \
(i64){0} \ (i64){0} \
@ -154,7 +506,6 @@ BEGIN_C_LINKAGE
.item_size = sizeof(u8) \ .item_size = sizeof(u8) \
}) })
#define wapp_u8_array_with_capacity(CAPACITY) ((U8Array){.items = (u8[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(u8)}) #define wapp_u8_array_with_capacity(CAPACITY) ((U8Array){.items = (u8[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(u8)})
#define wapp_u8_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((U8Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(u8)))
#define wapp_u8_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \ #define wapp_u8_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_u8_array_pop(ARRAY_PTR) : \ *_u8_array_pop(ARRAY_PTR) : \
(u8){0} \ (u8){0} \
@ -166,7 +517,6 @@ BEGIN_C_LINKAGE
.item_size = sizeof(u16) \ .item_size = sizeof(u16) \
}) })
#define wapp_u16_array_with_capacity(CAPACITY) ((U16Array){.items = (u16[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(u16)}) #define wapp_u16_array_with_capacity(CAPACITY) ((U16Array){.items = (u16[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(u16)})
#define wapp_u16_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((U16Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(u16)))
#define wapp_u16_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \ #define wapp_u16_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_u16_array_pop(ARRAY_PTR) : \ *_u16_array_pop(ARRAY_PTR) : \
(u16){0} \ (u16){0} \
@ -178,7 +528,6 @@ BEGIN_C_LINKAGE
.item_size = sizeof(u32) \ .item_size = sizeof(u32) \
}) })
#define wapp_u32_array_with_capacity(CAPACITY) ((U32Array){.items = (u32[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(u32)}) #define wapp_u32_array_with_capacity(CAPACITY) ((U32Array){.items = (u32[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(u32)})
#define wapp_u32_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((U32Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(u32)))
#define wapp_u32_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \ #define wapp_u32_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_u32_array_pop(ARRAY_PTR) : \ *_u32_array_pop(ARRAY_PTR) : \
(u32){0} \ (u32){0} \
@ -190,7 +539,6 @@ BEGIN_C_LINKAGE
.item_size = sizeof(u64) \ .item_size = sizeof(u64) \
}) })
#define wapp_u64_array_with_capacity(CAPACITY) ((U64Array){.items = (u64[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(u64)}) #define wapp_u64_array_with_capacity(CAPACITY) ((U64Array){.items = (u64[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(u64)})
#define wapp_u64_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((U64Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(u64)))
#define wapp_u64_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \ #define wapp_u64_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_u64_array_pop(ARRAY_PTR) : \ *_u64_array_pop(ARRAY_PTR) : \
(u64){0} \ (u64){0} \
@ -202,7 +550,6 @@ BEGIN_C_LINKAGE
.item_size = sizeof(f32) \ .item_size = sizeof(f32) \
}) })
#define wapp_f32_array_with_capacity(CAPACITY) ((F32Array){.items = (f32[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(f32)}) #define wapp_f32_array_with_capacity(CAPACITY) ((F32Array){.items = (f32[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(f32)})
#define wapp_f32_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((F32Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(f32)))
#define wapp_f32_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \ #define wapp_f32_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_f32_array_pop(ARRAY_PTR) : \ *_f32_array_pop(ARRAY_PTR) : \
(f32){0} \ (f32){0} \
@ -214,7 +561,6 @@ BEGIN_C_LINKAGE
.item_size = sizeof(f64) \ .item_size = sizeof(f64) \
}) })
#define wapp_f64_array_with_capacity(CAPACITY) ((F64Array){.items = (f64[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(f64)}) #define wapp_f64_array_with_capacity(CAPACITY) ((F64Array){.items = (f64[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(f64)})
#define wapp_f64_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((F64Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(f64)))
#define wapp_f64_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \ #define wapp_f64_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_f64_array_pop(ARRAY_PTR) : \ *_f64_array_pop(ARRAY_PTR) : \
(f64){0} \ (f64){0} \
@ -226,7 +572,6 @@ BEGIN_C_LINKAGE
.item_size = sizeof(f128) \ .item_size = sizeof(f128) \
}) })
#define wapp_f128_array_with_capacity(CAPACITY) ((F128Array){.items = (f128[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(f128)}) #define wapp_f128_array_with_capacity(CAPACITY) ((F128Array){.items = (f128[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(f128)})
#define wapp_f128_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((F128Array *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(f128)))
#define wapp_f128_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \ #define wapp_f128_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_f128_array_pop(ARRAY_PTR) : \ *_f128_array_pop(ARRAY_PTR) : \
(f128){0} \ (f128){0} \
@ -238,7 +583,6 @@ BEGIN_C_LINKAGE
.item_size = sizeof(iptr) \ .item_size = sizeof(iptr) \
}) })
#define wapp_iptr_array_with_capacity(CAPACITY) ((IptrArray){.items = (iptr[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(iptr)}) #define wapp_iptr_array_with_capacity(CAPACITY) ((IptrArray){.items = (iptr[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(iptr)})
#define wapp_iptr_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((IptrArray *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(iptr)))
#define wapp_iptr_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \ #define wapp_iptr_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_iptr_array_pop(ARRAY_PTR) : \ *_iptr_array_pop(ARRAY_PTR) : \
(iptr){0} \ (iptr){0} \
@ -250,11 +594,11 @@ BEGIN_C_LINKAGE
.item_size = sizeof(uptr) \ .item_size = sizeof(uptr) \
}) })
#define wapp_uptr_array_with_capacity(CAPACITY) ((UptrArray){.items = (uptr[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(uptr)}) #define wapp_uptr_array_with_capacity(CAPACITY) ((UptrArray){.items = (uptr[CAPACITY]){0}, .count = 0, .capacity = CAPACITY, .item_size = sizeof(uptr)})
#define wapp_uptr_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY) ((UptrArray *)_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY, sizeof(uptr)))
#define wapp_uptr_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \ #define wapp_uptr_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
*_uptr_array_pop(ARRAY_PTR) : \ *_uptr_array_pop(ARRAY_PTR) : \
(uptr){0} \ (uptr){0} \
) )
#endif // !WAPP_PLATFORM_CPP
typedef struct str8 Str8; typedef struct str8 Str8;