-
Notifications
You must be signed in to change notification settings - Fork 0
/
util.h
17 lines (14 loc) · 1.11 KB
/
util.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#pragma once
#define max(a, b) \
({ \
__typeof__(a) _a = (a); \
__typeof__(b) _b = (b); \
_a > _b ? _a : _b; \
})
#define min(a, b) \
({ \
__typeof__(a) _a = (a); \
__typeof__(b) _b = (b); \
_a < _b ? _a : _b; \
})
#define ARRAY_SIZE(x) ((sizeof(x) / sizeof(0 [x])) / ((size_t)(!(sizeof(x) % sizeof(0 [x])))))