-
Notifications
You must be signed in to change notification settings - Fork 0
/
math_utilities.h
29 lines (24 loc) · 986 Bytes
/
math_utilities.h
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
/*
* Copyright (c) 2012-2022 Israel Jacquez
* See LICENSE for details.
*
* Israel Jacquez <[email protected]>
*/
#ifndef _LIBSSUSB_MATH_UTILITIES_H_
#define _LIBSSUSB_MATH_UTILITIES_H_
#include "cdefs.h"
#ifndef min
#define min(a, b) \
__extension__ ({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
(_a < _b) ? _a : _b; \
})
#endif /* !min */
#ifndef max
#define max(a, b) \
__extension__ ({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
(_a > _b) ? _a : _b; \
})
#endif /* !max */
#endif /* !_LIBSSUSB_MATH_UTILITIES_H_ */