109 lines
2.1 KiB
C
109 lines
2.1 KiB
C
#ifndef ARRAYS_H
|
|
#define ARRAYS_H
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
// --- Boolean ---
|
|
typedef struct {
|
|
bool *items;
|
|
int32_t length;
|
|
int32_t capacity;
|
|
} bool_array;
|
|
|
|
bool bool_array_get(const bool_array *array, int32_t index);
|
|
|
|
// --- Char (Strings/Bytes) ---
|
|
typedef struct {
|
|
char *items;
|
|
int32_t length;
|
|
int32_t capacity;
|
|
} char_array;
|
|
|
|
char char_array_get(const char_array *array, int32_t index);
|
|
|
|
// --- Signed Integers ---
|
|
typedef struct {
|
|
int8_t *items;
|
|
int32_t length;
|
|
int32_t capacity;
|
|
} int8_array;
|
|
|
|
int8_t int8_array_get(const int8_array *array, int32_t index);
|
|
|
|
typedef struct {
|
|
int16_t *items;
|
|
int32_t length;
|
|
int32_t capacity;
|
|
} int16_array;
|
|
|
|
int16_t int16_array_get(const int16_array *array, int32_t index);
|
|
|
|
typedef struct {
|
|
int32_t *items;
|
|
int32_t length;
|
|
int32_t capacity;
|
|
} int32_array;
|
|
|
|
int32_t int32_array_get(const int32_array *array, int32_t index);
|
|
|
|
typedef struct {
|
|
int64_t *items;
|
|
int32_t length;
|
|
int32_t capacity;
|
|
} int64_array;
|
|
|
|
int64_t int64_array_get(const int64_array *array, int32_t index);
|
|
|
|
// --- Unsigned Integers ---
|
|
typedef struct {
|
|
uint8_t *items;
|
|
int32_t length;
|
|
int32_t capacity;
|
|
} uint8_array;
|
|
|
|
uint8_t uint8_array_get(const uint8_array *array, int32_t index);
|
|
|
|
typedef struct {
|
|
uint16_t *items;
|
|
int32_t length;
|
|
int32_t capacity;
|
|
} uint16_array;
|
|
|
|
uint16_t uint16_array_get(const uint16_array *array, int32_t index);
|
|
|
|
typedef struct {
|
|
uint32_t *items;
|
|
int32_t length;
|
|
int32_t capacity;
|
|
} uint32_array;
|
|
|
|
uint32_t uint32_array_get(const uint32_array *array, int32_t index);
|
|
|
|
typedef struct {
|
|
uint64_t *items;
|
|
int32_t length;
|
|
int32_t capacity;
|
|
} uint64_array;
|
|
|
|
uint64_t uint64_array_get(const uint64_array *array, int32_t index);
|
|
|
|
// --- Floating Point ---
|
|
typedef struct {
|
|
float *items;
|
|
int32_t length;
|
|
int32_t capacity;
|
|
} float_array;
|
|
|
|
float float_array_get(const float_array *array, int32_t index);
|
|
|
|
typedef struct {
|
|
double *items;
|
|
int32_t length;
|
|
int32_t capacity;
|
|
} double_array;
|
|
|
|
double double_array_get(const double_array *array, int32_t index);
|
|
|
|
#endif
|