#ifndef _PIUMA_LIB_DS_H_ #define _PIUMA_LIB_DS_H_ #include "types.h" #include "stdlib.h" typedef int compare_fn(const void *, const void *); // Basic compare functions int char_cmp(const void *a, const void *b); int u8_cmp (const void *a, const void *b); int u32_cmp(const void *a, const void *b); int u64_cmp(const void *a, const void *b); int s32_cmp(const void *a, const void *b); int s64_cmp(const void *a, const void *b); // Modifies "array" and returns the number of unique things u64 make_unique(void *array, u64 count, u64 element_size, compare_fn *cmp); // @Cleanup: put this in the right place template void swap(T &a, T &b) { T tmp = a; a = b; b = tmp; } #endif