/*
 * 3D Engine 
 * array.h: 
 * Based on pikuma.com 3D software renderer in C
 * Copyright (c) 2021 986-Studio. All rights reserved.
 *
 * Created by Manoël Trapier on 04/03/2021.
 */

#ifndef THREEDENGINE_SOURCE_INCLUDE_ARRAY_H
#define THREEDENGINE_SOURCE_INCLUDE_ARRAY_H

#include <stdlib.h>
#include <stdint.h>

/***********************************************************************************************************************
 * Prototypes
 **********************************************************************************************************************/
#define arrayAdd(_array, _data) do { \
        (_array) = arrayCheckSize((_array), 1, sizeof(_data)); \
        uint32_t lenght = arrayGetSize((_array));  \
        (_array)[lenght - 1] = (_data); \
} while(0)

void *arrayCheckSize(void *array, uint32_t count, size_t typeSize);
uint32_t arrayGetSize(void *array);
void arrayEmpty(void *array);
void arrayFree(void *array);


#endif /* THREEDENGINE_SOURCE_INCLUDE_ARRAY_H */
