Fix bug in array codegen
This commit is contained in:
parent
6c8434a530
commit
74164717d0
@ -1,4 +1,4 @@
|
||||
assert(array != NULL & index < array->count);
|
||||
assert(array != NULL && index < array->count);
|
||||
|
||||
u8 *ptr = (u8 *)(array->items) + (array->item_size * index);
|
||||
return ({T} *)ptr;
|
||||
|
@ -1,4 +1,4 @@
|
||||
assert(allocator != NULL & src != NULL && dst != NULL);
|
||||
assert(allocator != NULL && src != NULL && dst != NULL);
|
||||
|
||||
{ArrayType} *output = dst;
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
Str8 *wapp_str8_array_get(const Str8Array *array, u64 index) {
|
||||
assert(array != NULL & index < array->count);
|
||||
assert(array != NULL && index < array->count);
|
||||
|
||||
u8 *ptr = (u8 *)(array->items) + (array->item_size * index);
|
||||
return (Str8 *)ptr;
|
||||
@ -131,7 +131,7 @@ RETURN_STR8_ARRAY_EXTEND_ALLOC:
|
||||
}
|
||||
|
||||
Str8Array *wapp_str8_array_copy_alloc(const Allocator *allocator, const Str8Array *src, Str8Array *dst) {
|
||||
assert(allocator != NULL & src != NULL && dst != NULL);
|
||||
assert(allocator != NULL && src != NULL && dst != NULL);
|
||||
|
||||
Str8Array *output = dst;
|
||||
|
||||
@ -159,7 +159,7 @@ Str8 *_str8_array_pop(Str8Array *array) {
|
||||
}
|
||||
|
||||
void * *wapp_void_ptr_array_get(const VoidPArray *array, u64 index) {
|
||||
assert(array != NULL & index < array->count);
|
||||
assert(array != NULL && index < array->count);
|
||||
|
||||
u8 *ptr = (u8 *)(array->items) + (array->item_size * index);
|
||||
return (void * *)ptr;
|
||||
@ -278,7 +278,7 @@ RETURN_VOID_PTR_ARRAY_EXTEND_ALLOC:
|
||||
}
|
||||
|
||||
VoidPArray *wapp_void_ptr_array_copy_alloc(const Allocator *allocator, const VoidPArray *src, VoidPArray *dst) {
|
||||
assert(allocator != NULL & src != NULL && dst != NULL);
|
||||
assert(allocator != NULL && src != NULL && dst != NULL);
|
||||
|
||||
VoidPArray *output = dst;
|
||||
|
||||
@ -306,7 +306,7 @@ void * *_void_ptr_array_pop(VoidPArray *array) {
|
||||
}
|
||||
|
||||
bool *wapp_bool_array_get(const BoolArray *array, u64 index) {
|
||||
assert(array != NULL & index < array->count);
|
||||
assert(array != NULL && index < array->count);
|
||||
|
||||
u8 *ptr = (u8 *)(array->items) + (array->item_size * index);
|
||||
return (bool *)ptr;
|
||||
@ -425,7 +425,7 @@ RETURN_BOOL_ARRAY_EXTEND_ALLOC:
|
||||
}
|
||||
|
||||
BoolArray *wapp_bool_array_copy_alloc(const Allocator *allocator, const BoolArray *src, BoolArray *dst) {
|
||||
assert(allocator != NULL & src != NULL && dst != NULL);
|
||||
assert(allocator != NULL && src != NULL && dst != NULL);
|
||||
|
||||
BoolArray *output = dst;
|
||||
|
||||
@ -453,7 +453,7 @@ bool *_bool_array_pop(BoolArray *array) {
|
||||
}
|
||||
|
||||
char *wapp_char_array_get(const CharArray *array, u64 index) {
|
||||
assert(array != NULL & index < array->count);
|
||||
assert(array != NULL && index < array->count);
|
||||
|
||||
u8 *ptr = (u8 *)(array->items) + (array->item_size * index);
|
||||
return (char *)ptr;
|
||||
@ -572,7 +572,7 @@ RETURN_CHAR_ARRAY_EXTEND_ALLOC:
|
||||
}
|
||||
|
||||
CharArray *wapp_char_array_copy_alloc(const Allocator *allocator, const CharArray *src, CharArray *dst) {
|
||||
assert(allocator != NULL & src != NULL && dst != NULL);
|
||||
assert(allocator != NULL && src != NULL && dst != NULL);
|
||||
|
||||
CharArray *output = dst;
|
||||
|
||||
@ -600,7 +600,7 @@ char *_char_array_pop(CharArray *array) {
|
||||
}
|
||||
|
||||
c8 *wapp_c8_array_get(const C8Array *array, u64 index) {
|
||||
assert(array != NULL & index < array->count);
|
||||
assert(array != NULL && index < array->count);
|
||||
|
||||
u8 *ptr = (u8 *)(array->items) + (array->item_size * index);
|
||||
return (c8 *)ptr;
|
||||
@ -719,7 +719,7 @@ RETURN_C8_ARRAY_EXTEND_ALLOC:
|
||||
}
|
||||
|
||||
C8Array *wapp_c8_array_copy_alloc(const Allocator *allocator, const C8Array *src, C8Array *dst) {
|
||||
assert(allocator != NULL & src != NULL && dst != NULL);
|
||||
assert(allocator != NULL && src != NULL && dst != NULL);
|
||||
|
||||
C8Array *output = dst;
|
||||
|
||||
@ -747,7 +747,7 @@ c8 *_c8_array_pop(C8Array *array) {
|
||||
}
|
||||
|
||||
c16 *wapp_c16_array_get(const C16Array *array, u64 index) {
|
||||
assert(array != NULL & index < array->count);
|
||||
assert(array != NULL && index < array->count);
|
||||
|
||||
u8 *ptr = (u8 *)(array->items) + (array->item_size * index);
|
||||
return (c16 *)ptr;
|
||||
@ -866,7 +866,7 @@ RETURN_C16_ARRAY_EXTEND_ALLOC:
|
||||
}
|
||||
|
||||
C16Array *wapp_c16_array_copy_alloc(const Allocator *allocator, const C16Array *src, C16Array *dst) {
|
||||
assert(allocator != NULL & src != NULL && dst != NULL);
|
||||
assert(allocator != NULL && src != NULL && dst != NULL);
|
||||
|
||||
C16Array *output = dst;
|
||||
|
||||
@ -894,7 +894,7 @@ c16 *_c16_array_pop(C16Array *array) {
|
||||
}
|
||||
|
||||
c32 *wapp_c32_array_get(const C32Array *array, u64 index) {
|
||||
assert(array != NULL & index < array->count);
|
||||
assert(array != NULL && index < array->count);
|
||||
|
||||
u8 *ptr = (u8 *)(array->items) + (array->item_size * index);
|
||||
return (c32 *)ptr;
|
||||
@ -1013,7 +1013,7 @@ RETURN_C32_ARRAY_EXTEND_ALLOC:
|
||||
}
|
||||
|
||||
C32Array *wapp_c32_array_copy_alloc(const Allocator *allocator, const C32Array *src, C32Array *dst) {
|
||||
assert(allocator != NULL & src != NULL && dst != NULL);
|
||||
assert(allocator != NULL && src != NULL && dst != NULL);
|
||||
|
||||
C32Array *output = dst;
|
||||
|
||||
@ -1041,7 +1041,7 @@ c32 *_c32_array_pop(C32Array *array) {
|
||||
}
|
||||
|
||||
i8 *wapp_i8_array_get(const I8Array *array, u64 index) {
|
||||
assert(array != NULL & index < array->count);
|
||||
assert(array != NULL && index < array->count);
|
||||
|
||||
u8 *ptr = (u8 *)(array->items) + (array->item_size * index);
|
||||
return (i8 *)ptr;
|
||||
@ -1160,7 +1160,7 @@ RETURN_I8_ARRAY_EXTEND_ALLOC:
|
||||
}
|
||||
|
||||
I8Array *wapp_i8_array_copy_alloc(const Allocator *allocator, const I8Array *src, I8Array *dst) {
|
||||
assert(allocator != NULL & src != NULL && dst != NULL);
|
||||
assert(allocator != NULL && src != NULL && dst != NULL);
|
||||
|
||||
I8Array *output = dst;
|
||||
|
||||
@ -1188,7 +1188,7 @@ i8 *_i8_array_pop(I8Array *array) {
|
||||
}
|
||||
|
||||
i16 *wapp_i16_array_get(const I16Array *array, u64 index) {
|
||||
assert(array != NULL & index < array->count);
|
||||
assert(array != NULL && index < array->count);
|
||||
|
||||
u8 *ptr = (u8 *)(array->items) + (array->item_size * index);
|
||||
return (i16 *)ptr;
|
||||
@ -1307,7 +1307,7 @@ RETURN_I16_ARRAY_EXTEND_ALLOC:
|
||||
}
|
||||
|
||||
I16Array *wapp_i16_array_copy_alloc(const Allocator *allocator, const I16Array *src, I16Array *dst) {
|
||||
assert(allocator != NULL & src != NULL && dst != NULL);
|
||||
assert(allocator != NULL && src != NULL && dst != NULL);
|
||||
|
||||
I16Array *output = dst;
|
||||
|
||||
@ -1335,7 +1335,7 @@ i16 *_i16_array_pop(I16Array *array) {
|
||||
}
|
||||
|
||||
i32 *wapp_i32_array_get(const I32Array *array, u64 index) {
|
||||
assert(array != NULL & index < array->count);
|
||||
assert(array != NULL && index < array->count);
|
||||
|
||||
u8 *ptr = (u8 *)(array->items) + (array->item_size * index);
|
||||
return (i32 *)ptr;
|
||||
@ -1454,7 +1454,7 @@ RETURN_I32_ARRAY_EXTEND_ALLOC:
|
||||
}
|
||||
|
||||
I32Array *wapp_i32_array_copy_alloc(const Allocator *allocator, const I32Array *src, I32Array *dst) {
|
||||
assert(allocator != NULL & src != NULL && dst != NULL);
|
||||
assert(allocator != NULL && src != NULL && dst != NULL);
|
||||
|
||||
I32Array *output = dst;
|
||||
|
||||
@ -1482,7 +1482,7 @@ i32 *_i32_array_pop(I32Array *array) {
|
||||
}
|
||||
|
||||
i64 *wapp_i64_array_get(const I64Array *array, u64 index) {
|
||||
assert(array != NULL & index < array->count);
|
||||
assert(array != NULL && index < array->count);
|
||||
|
||||
u8 *ptr = (u8 *)(array->items) + (array->item_size * index);
|
||||
return (i64 *)ptr;
|
||||
@ -1601,7 +1601,7 @@ RETURN_I64_ARRAY_EXTEND_ALLOC:
|
||||
}
|
||||
|
||||
I64Array *wapp_i64_array_copy_alloc(const Allocator *allocator, const I64Array *src, I64Array *dst) {
|
||||
assert(allocator != NULL & src != NULL && dst != NULL);
|
||||
assert(allocator != NULL && src != NULL && dst != NULL);
|
||||
|
||||
I64Array *output = dst;
|
||||
|
||||
@ -1629,7 +1629,7 @@ i64 *_i64_array_pop(I64Array *array) {
|
||||
}
|
||||
|
||||
u8 *wapp_u8_array_get(const U8Array *array, u64 index) {
|
||||
assert(array != NULL & index < array->count);
|
||||
assert(array != NULL && index < array->count);
|
||||
|
||||
u8 *ptr = (u8 *)(array->items) + (array->item_size * index);
|
||||
return (u8 *)ptr;
|
||||
@ -1748,7 +1748,7 @@ RETURN_U8_ARRAY_EXTEND_ALLOC:
|
||||
}
|
||||
|
||||
U8Array *wapp_u8_array_copy_alloc(const Allocator *allocator, const U8Array *src, U8Array *dst) {
|
||||
assert(allocator != NULL & src != NULL && dst != NULL);
|
||||
assert(allocator != NULL && src != NULL && dst != NULL);
|
||||
|
||||
U8Array *output = dst;
|
||||
|
||||
@ -1776,7 +1776,7 @@ u8 *_u8_array_pop(U8Array *array) {
|
||||
}
|
||||
|
||||
u16 *wapp_u16_array_get(const U16Array *array, u64 index) {
|
||||
assert(array != NULL & index < array->count);
|
||||
assert(array != NULL && index < array->count);
|
||||
|
||||
u8 *ptr = (u8 *)(array->items) + (array->item_size * index);
|
||||
return (u16 *)ptr;
|
||||
@ -1895,7 +1895,7 @@ RETURN_U16_ARRAY_EXTEND_ALLOC:
|
||||
}
|
||||
|
||||
U16Array *wapp_u16_array_copy_alloc(const Allocator *allocator, const U16Array *src, U16Array *dst) {
|
||||
assert(allocator != NULL & src != NULL && dst != NULL);
|
||||
assert(allocator != NULL && src != NULL && dst != NULL);
|
||||
|
||||
U16Array *output = dst;
|
||||
|
||||
@ -1923,7 +1923,7 @@ u16 *_u16_array_pop(U16Array *array) {
|
||||
}
|
||||
|
||||
u32 *wapp_u32_array_get(const U32Array *array, u64 index) {
|
||||
assert(array != NULL & index < array->count);
|
||||
assert(array != NULL && index < array->count);
|
||||
|
||||
u8 *ptr = (u8 *)(array->items) + (array->item_size * index);
|
||||
return (u32 *)ptr;
|
||||
@ -2042,7 +2042,7 @@ RETURN_U32_ARRAY_EXTEND_ALLOC:
|
||||
}
|
||||
|
||||
U32Array *wapp_u32_array_copy_alloc(const Allocator *allocator, const U32Array *src, U32Array *dst) {
|
||||
assert(allocator != NULL & src != NULL && dst != NULL);
|
||||
assert(allocator != NULL && src != NULL && dst != NULL);
|
||||
|
||||
U32Array *output = dst;
|
||||
|
||||
@ -2070,7 +2070,7 @@ u32 *_u32_array_pop(U32Array *array) {
|
||||
}
|
||||
|
||||
u64 *wapp_u64_array_get(const U64Array *array, u64 index) {
|
||||
assert(array != NULL & index < array->count);
|
||||
assert(array != NULL && index < array->count);
|
||||
|
||||
u8 *ptr = (u8 *)(array->items) + (array->item_size * index);
|
||||
return (u64 *)ptr;
|
||||
@ -2189,7 +2189,7 @@ RETURN_U64_ARRAY_EXTEND_ALLOC:
|
||||
}
|
||||
|
||||
U64Array *wapp_u64_array_copy_alloc(const Allocator *allocator, const U64Array *src, U64Array *dst) {
|
||||
assert(allocator != NULL & src != NULL && dst != NULL);
|
||||
assert(allocator != NULL && src != NULL && dst != NULL);
|
||||
|
||||
U64Array *output = dst;
|
||||
|
||||
@ -2217,7 +2217,7 @@ u64 *_u64_array_pop(U64Array *array) {
|
||||
}
|
||||
|
||||
f32 *wapp_f32_array_get(const F32Array *array, u64 index) {
|
||||
assert(array != NULL & index < array->count);
|
||||
assert(array != NULL && index < array->count);
|
||||
|
||||
u8 *ptr = (u8 *)(array->items) + (array->item_size * index);
|
||||
return (f32 *)ptr;
|
||||
@ -2336,7 +2336,7 @@ RETURN_F32_ARRAY_EXTEND_ALLOC:
|
||||
}
|
||||
|
||||
F32Array *wapp_f32_array_copy_alloc(const Allocator *allocator, const F32Array *src, F32Array *dst) {
|
||||
assert(allocator != NULL & src != NULL && dst != NULL);
|
||||
assert(allocator != NULL && src != NULL && dst != NULL);
|
||||
|
||||
F32Array *output = dst;
|
||||
|
||||
@ -2364,7 +2364,7 @@ f32 *_f32_array_pop(F32Array *array) {
|
||||
}
|
||||
|
||||
f64 *wapp_f64_array_get(const F64Array *array, u64 index) {
|
||||
assert(array != NULL & index < array->count);
|
||||
assert(array != NULL && index < array->count);
|
||||
|
||||
u8 *ptr = (u8 *)(array->items) + (array->item_size * index);
|
||||
return (f64 *)ptr;
|
||||
@ -2483,7 +2483,7 @@ RETURN_F64_ARRAY_EXTEND_ALLOC:
|
||||
}
|
||||
|
||||
F64Array *wapp_f64_array_copy_alloc(const Allocator *allocator, const F64Array *src, F64Array *dst) {
|
||||
assert(allocator != NULL & src != NULL && dst != NULL);
|
||||
assert(allocator != NULL && src != NULL && dst != NULL);
|
||||
|
||||
F64Array *output = dst;
|
||||
|
||||
@ -2511,7 +2511,7 @@ f64 *_f64_array_pop(F64Array *array) {
|
||||
}
|
||||
|
||||
f128 *wapp_f128_array_get(const F128Array *array, u64 index) {
|
||||
assert(array != NULL & index < array->count);
|
||||
assert(array != NULL && index < array->count);
|
||||
|
||||
u8 *ptr = (u8 *)(array->items) + (array->item_size * index);
|
||||
return (f128 *)ptr;
|
||||
@ -2630,7 +2630,7 @@ RETURN_F128_ARRAY_EXTEND_ALLOC:
|
||||
}
|
||||
|
||||
F128Array *wapp_f128_array_copy_alloc(const Allocator *allocator, const F128Array *src, F128Array *dst) {
|
||||
assert(allocator != NULL & src != NULL && dst != NULL);
|
||||
assert(allocator != NULL && src != NULL && dst != NULL);
|
||||
|
||||
F128Array *output = dst;
|
||||
|
||||
@ -2658,7 +2658,7 @@ f128 *_f128_array_pop(F128Array *array) {
|
||||
}
|
||||
|
||||
iptr *wapp_iptr_array_get(const IptrArray *array, u64 index) {
|
||||
assert(array != NULL & index < array->count);
|
||||
assert(array != NULL && index < array->count);
|
||||
|
||||
u8 *ptr = (u8 *)(array->items) + (array->item_size * index);
|
||||
return (iptr *)ptr;
|
||||
@ -2777,7 +2777,7 @@ RETURN_IPTR_ARRAY_EXTEND_ALLOC:
|
||||
}
|
||||
|
||||
IptrArray *wapp_iptr_array_copy_alloc(const Allocator *allocator, const IptrArray *src, IptrArray *dst) {
|
||||
assert(allocator != NULL & src != NULL && dst != NULL);
|
||||
assert(allocator != NULL && src != NULL && dst != NULL);
|
||||
|
||||
IptrArray *output = dst;
|
||||
|
||||
@ -2805,7 +2805,7 @@ iptr *_iptr_array_pop(IptrArray *array) {
|
||||
}
|
||||
|
||||
uptr *wapp_uptr_array_get(const UptrArray *array, u64 index) {
|
||||
assert(array != NULL & index < array->count);
|
||||
assert(array != NULL && index < array->count);
|
||||
|
||||
u8 *ptr = (u8 *)(array->items) + (array->item_size * index);
|
||||
return (uptr *)ptr;
|
||||
@ -2924,7 +2924,7 @@ RETURN_UPTR_ARRAY_EXTEND_ALLOC:
|
||||
}
|
||||
|
||||
UptrArray *wapp_uptr_array_copy_alloc(const Allocator *allocator, const UptrArray *src, UptrArray *dst) {
|
||||
assert(allocator != NULL & src != NULL && dst != NULL);
|
||||
assert(allocator != NULL && src != NULL && dst != NULL);
|
||||
|
||||
UptrArray *output = dst;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user