remove static aliases, some list helpers
This commit is contained in:
20
core.h
20
core.h
@@ -14,9 +14,6 @@
|
||||
#define Assert(expression)
|
||||
#endif
|
||||
|
||||
#define function static
|
||||
#define global static
|
||||
#define local_persist static
|
||||
#define Forever for (;;)
|
||||
|
||||
#define DeferLoop(begin_stmnt, end_stmnt) for(int __defer_i = ((begin_stmnt), 0); __defer_i < 1; (++__defer_i, (end_stmnt)))
|
||||
@@ -91,7 +88,7 @@ union Vec2 {
|
||||
};
|
||||
real32 vec[2];
|
||||
};
|
||||
inline function Vec2 vec2(real32 x, real32 y) {
|
||||
inline Vec2 vec2(real32 x, real32 y) {
|
||||
Vec2 result = {0};
|
||||
result.x = x;
|
||||
result.y = y;
|
||||
@@ -107,7 +104,7 @@ union Vec3 {
|
||||
};
|
||||
real32 vec[3];
|
||||
};
|
||||
inline function Vec3 vec3(real32 x, real32 y, real32 z) {
|
||||
inline Vec3 vec3(real32 x, real32 y, real32 z) {
|
||||
Vec3 result = {0};
|
||||
result.x = x;
|
||||
result.y = y;
|
||||
@@ -131,7 +128,7 @@ union Vec4 {
|
||||
};
|
||||
real32 vec[4];
|
||||
};
|
||||
inline function Vec4 vec4(real32 x, real32 y, real32 z, real32 w) {
|
||||
inline Vec4 vec4(real32 x, real32 y, real32 z, real32 w) {
|
||||
Vec4 result = {0};
|
||||
result.x = x;
|
||||
result.y = y;
|
||||
@@ -169,11 +166,11 @@ void *__listcopyhelper__;
|
||||
if ((list).length < (list).capacity) { \
|
||||
(list).data[(list).length++] = (element); \
|
||||
}
|
||||
#define ZeroListFull(list) memset((list)->data, 0, (list)->length * sizeof((list)->data[0]))
|
||||
#define ZeroList(list) (list)->length = 0; \
|
||||
memset((list)->data, 0, (list)->length * sizeof((list)->data[0]))
|
||||
/** 1 indicates last element, 2 second last, etc. */
|
||||
#define ListGetFromEnd(list, count) ((list).data[(list).length - (count)])
|
||||
|
||||
|
||||
#define ZeroList(list) /** Keeps the list's length and sets all memory to 0 */ memset((list).data, 0, (list).length * sizeof((list).data[0]))
|
||||
#define ClearList(list) /** Clears the list by setting all memory and the length to 0 */ (list).length = 0; memset((list).data, 0, (list).length * sizeof((list).data[0]))
|
||||
#define ListGetFromEnd(list, count) /** 1 indicates last element, 2 second last, etc. */ ((list).data[(list).length - (count)])
|
||||
#define ListLast(list) ListGetFromEnd(list, 1)
|
||||
|
||||
inline VoidList __cloneList(Arena *arena, VoidList list, size_t underlyingSize) {
|
||||
@@ -339,6 +336,7 @@ extern void (*println)(const char *fmt, ...);
|
||||
#define EachIn(list, it) size_t it = 0; it < (list).length; it++
|
||||
#define EachEl(list, type, element) type *element = (list).data; element < (list).data + (list).length; element += 1
|
||||
#define EachInReversed(list, it) size_t it = (list).length - 1; it >= 0 && it < (list).length; it--
|
||||
#define EachElReversed(list, type, element) type *element = (list).data + (list).length - 1; element >= (list).data; element -= 1
|
||||
#define EachInArray(arr, it) size_t it = 0; it < ArrayCount(arr); ++it
|
||||
|
||||
// ### Misc ###
|
||||
|
||||
Reference in New Issue
Block a user