mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-26 07:17:23 +00:00
[common] only define min/max if they have not already been defined
This commit is contained in:
parent
952ebea2c5
commit
912ca62a7b
@ -21,10 +21,15 @@
|
|||||||
#ifndef _H_LG_COMMON_UTIL_
|
#ifndef _H_LG_COMMON_UTIL_
|
||||||
#define _H_LG_COMMON_UTIL_
|
#define _H_LG_COMMON_UTIL_
|
||||||
|
|
||||||
|
#ifndef min
|
||||||
#define min(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); \
|
#define min(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); \
|
||||||
_a < _b ? _a : _b; })
|
_a < _b ? _a : _b; })
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef max
|
||||||
#define max(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); \
|
#define max(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); \
|
||||||
_a > _b ? _a : _b; })
|
_a > _b ? _a : _b; })
|
||||||
|
#endif
|
||||||
|
|
||||||
#define UPCAST(type, x) \
|
#define UPCAST(type, x) \
|
||||||
(type *)((uintptr_t)(x) - offsetof(type, base))
|
(type *)((uintptr_t)(x) - offsetof(type, base))
|
||||||
|
Loading…
Reference in New Issue
Block a user