Changeset View
Changeset View
Standalone View
Standalone View
head/sys/compat/linuxkpi/common/include/linux/kernel.h
Show First 20 Lines • Show All 456 Lines • ▼ Show 20 Lines | #define min_t(type, x, y) ({ \ | ||||
type __min2 = (y); \ | type __min2 = (y); \ | ||||
__min1 < __min2 ? __min1 : __min2; }) | __min1 < __min2 ? __min1 : __min2; }) | ||||
#define max_t(type, x, y) ({ \ | #define max_t(type, x, y) ({ \ | ||||
type __max1 = (x); \ | type __max1 = (x); \ | ||||
type __max2 = (y); \ | type __max2 = (y); \ | ||||
__max1 > __max2 ? __max1 : __max2; }) | __max1 > __max2 ? __max1 : __max2; }) | ||||
#define offsetofend(t, m) \ | |||||
(offsetof(t, m) + sizeof((((t *)0)->m))) | |||||
#define clamp_t(type, _x, min, max) min_t(type, max_t(type, _x, min), max) | #define clamp_t(type, _x, min, max) min_t(type, max_t(type, _x, min), max) | ||||
#define clamp(x, lo, hi) min( max(x,lo), hi) | #define clamp(x, lo, hi) min( max(x,lo), hi) | ||||
#define clamp_val(val, lo, hi) clamp_t(typeof(val), val, lo, hi) | #define clamp_val(val, lo, hi) clamp_t(typeof(val), val, lo, hi) | ||||
/* | /* | ||||
* This looks more complex than it should be. But we need to | * This looks more complex than it should be. But we need to | ||||
* get the type for the ~ right in round_down (it needs to be | * get the type for the ~ right in round_down (it needs to be | ||||
* as wide as the result!), and we want to evaluate the macro | * as wide as the result!), and we want to evaluate the macro | ||||
▲ Show 20 Lines • Show All 62 Lines • Show Last 20 Lines |