#ifndef SWIFT_DATA_TYPES_H
#define SWIFT_DATA_TYPES_H

#include <limits.h>

#define SWIFT_MIN(a, b) ((a < b) ? (a) : (b))
#define SWIFT_MAX(a, b) ((a > b) ? (a) : (b))

#define SWIFT_OFFSET_OF(type, member) ((size_t)(&((type *)0)->member))
#define SWIFT_CONTAINER_OF(ptr, type, member) \
	((type *)((char *)ptr - SWIFT_OFFSET_OF(type, member)))

#define SWIFT_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
#define SWIFT_BIT_SIZE(t) (sizeof(t) * CHAR_BIT)

typedef size_t (* swift_hash_fn_t)(const void *data);
typedef bool (* swift_eq_fn_t)(const void *lhs, const void *rhs);
typedef int (* swift_cmp_fn_t)(const void *lhs, const void *rhs);

#endif /* SWIFT_DATA_TYPES_H */
