aboutsummaryrefslogtreecommitdiff
path: root/src/util/inc/util.h
blob: e42c5b21b554d975e488dbd345f623a5e0324b99 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef UTIL_H
#define UTIL_H

#include <stdbool.h>

#ifdef __cplusplus
extern "C"
{
#endif

#if __STDC_VERSION__ >= 201112L
#define UTIL_STATIC_ASSERT(exp, msg) _Static_assert(exp, msg)
#else
#define UTIL_STATIC_ASSERT__(exp, l, msg) enum {static_assert##l##__ = 1 / !!(exp)}
#define UTIL_STATIC_ASSERT_(exp, l, msg) UTIL_STATIC_ASSERT__(exp, l, msg)
#define UTIL_STATIC_ASSERT(exp, msg) UTIL_STATIC_ASSERT_(exp, __LINE__, msg)
#endif

struct util_rect
{
    unsigned long x, y;
    short w, h;
};

bool util_collision(const struct util_rect *a, const struct util_rect *b);

#ifdef __cplusplus
}
#endif

#endif /* UTIL_H */