mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-14 17:28:07 +00:00
indent macros
This commit is contained in:
+41
-41
@@ -5,51 +5,51 @@
|
|||||||
//~ rjf: API Implementation Helper Macros
|
//~ rjf: API Implementation Helper Macros
|
||||||
|
|
||||||
#define RDIM_IdxedChunkListPush(arena, list, chunk_type, element_type, cap_value, result, ...) \
|
#define RDIM_IdxedChunkListPush(arena, list, chunk_type, element_type, cap_value, result, ...) \
|
||||||
element_type *result = 0;\
|
element_type *result = 0; \
|
||||||
do\
|
do \
|
||||||
{\
|
{ \
|
||||||
chunk_type *n = list->last;\
|
chunk_type *n = list->last; \
|
||||||
if(n == 0 || n->count >= n->cap)\
|
if(n == 0 || n->count >= n->cap) \
|
||||||
{\
|
{ \
|
||||||
n = rdim_push_array(arena, chunk_type, 1);\
|
n = rdim_push_array(arena, chunk_type, 1); \
|
||||||
n->cap = cap_value;\
|
n->cap = cap_value; \
|
||||||
n->base_idx = list->total_count;\
|
n->base_idx = list->total_count; \
|
||||||
__VA_ARGS__;\
|
__VA_ARGS__; \
|
||||||
n->v = rdim_push_array_no_zero(arena, element_type, n->cap);\
|
n->v = rdim_push_array_no_zero(arena, element_type, n->cap); \
|
||||||
RDIM_SLLQueuePush(list->first, list->last, n);\
|
RDIM_SLLQueuePush(list->first, list->last, n); \
|
||||||
list->chunk_count += 1;\
|
list->chunk_count += 1; \
|
||||||
}\
|
} \
|
||||||
result = &n->v[n->count];\
|
result = &n->v[n->count]; \
|
||||||
result->chunk = n;\
|
result->chunk = n; \
|
||||||
n->count += 1;\
|
n->count += 1; \
|
||||||
list->total_count += 1;\
|
list->total_count += 1; \
|
||||||
}while(0)
|
}while(0)
|
||||||
|
|
||||||
#define RDIM_IdxedChunkListElementGetIdx(ptr, result) \
|
#define RDIM_IdxedChunkListElementGetIdx(ptr, result) \
|
||||||
RDI_U64 idx = 0;\
|
RDI_U64 idx = 0; \
|
||||||
if(ptr != 0 && ptr->chunk != 0)\
|
if(ptr != 0 && ptr->chunk != 0) \
|
||||||
{\
|
{ \
|
||||||
idx = ptr->chunk->base_idx + (ptr - ptr->chunk->v) + 1;\
|
idx = ptr->chunk->base_idx + (ptr - ptr->chunk->v) + 1; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RDIM_IdxedChunkListConcatInPlace(chunk_type, dst, to_push, ...) \
|
#define RDIM_IdxedChunkListConcatInPlace(chunk_type, dst, to_push, ...) \
|
||||||
for(chunk_type *n = to_push->first; n != 0; n = n->next)\
|
for(chunk_type *n = to_push->first; n != 0; n = n->next) \
|
||||||
{\
|
{ \
|
||||||
n->base_idx += dst->total_count;\
|
n->base_idx += dst->total_count; \
|
||||||
}\
|
} \
|
||||||
if(dst->last != 0 && to_push->first != 0)\
|
if(dst->last != 0 && to_push->first != 0) \
|
||||||
{\
|
{ \
|
||||||
dst->last->next = to_push->first;\
|
dst->last->next = to_push->first; \
|
||||||
dst->last = to_push->last;\
|
dst->last = to_push->last; \
|
||||||
dst->chunk_count += to_push->chunk_count;\
|
dst->chunk_count += to_push->chunk_count; \
|
||||||
dst->total_count += to_push->total_count;\
|
dst->total_count += to_push->total_count; \
|
||||||
__VA_ARGS__;\
|
__VA_ARGS__; \
|
||||||
}\
|
} \
|
||||||
else if(dst->first == 0)\
|
else if(dst->first == 0) \
|
||||||
{\
|
{ \
|
||||||
rdim_memcpy_struct(dst, to_push);\
|
rdim_memcpy_struct(dst, to_push); \
|
||||||
}\
|
} \
|
||||||
rdim_memzero_struct(to_push);
|
rdim_memzero_struct(to_push);
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Basic Helpers
|
//~ rjf: Basic Helpers
|
||||||
|
|||||||
Reference in New Issue
Block a user