kernel.h (bf27839aa90a4a90ef4b3e59f2a362d36f1e7051) kernel.h (d3584f92835a07d76bc579168ac5fdc3e020d5f0)
1/*-
2 * Copyright (c) 2010 Isilon Systems, Inc.
3 * Copyright (c) 2010 iX Systems, Inc.
4 * Copyright (c) 2010 Panasas, Inc.
5 * Copyright (c) 2013-2016 Mellanox Technologies, Ltd.
6 * Copyright (c) 2014-2015 François Tigeot
7 * All rights reserved.
8 *

--- 563 unchanged lines hidden (view full) ---

572#define max_t(type, x, y) ({ \
573 type __max1 = (x); \
574 type __max2 = (y); \
575 __max1 > __max2 ? __max1 : __max2; })
576
577#define offsetofend(t, m) \
578 (offsetof(t, m) + sizeof((((t *)0)->m)))
579
1/*-
2 * Copyright (c) 2010 Isilon Systems, Inc.
3 * Copyright (c) 2010 iX Systems, Inc.
4 * Copyright (c) 2010 Panasas, Inc.
5 * Copyright (c) 2013-2016 Mellanox Technologies, Ltd.
6 * Copyright (c) 2014-2015 François Tigeot
7 * All rights reserved.
8 *

--- 563 unchanged lines hidden (view full) ---

572#define max_t(type, x, y) ({ \
573 type __max1 = (x); \
574 type __max2 = (y); \
575 __max1 > __max2 ? __max1 : __max2; })
576
577#define offsetofend(t, m) \
578 (offsetof(t, m) + sizeof((((t *)0)->m)))
579
580#define typeof_member(s, e) typeof(((s *)0)->e)
581
580#define clamp_t(type, _x, min, max) min_t(type, max_t(type, _x, min), max)
581#define clamp(x, lo, hi) min( max(x,lo), hi)
582#define clamp_val(val, lo, hi) clamp_t(typeof(val), val, lo, hi)
583
584/*
585 * This looks more complex than it should be. But we need to
586 * get the type for the ~ right in round_down (it needs to be
587 * as wide as the result!), and we want to evaluate the macro

--- 177 unchanged lines hidden ---
582#define clamp_t(type, _x, min, max) min_t(type, max_t(type, _x, min), max)
583#define clamp(x, lo, hi) min( max(x,lo), hi)
584#define clamp_val(val, lo, hi) clamp_t(typeof(val), val, lo, hi)
585
586/*
587 * This looks more complex than it should be. But we need to
588 * get the type for the ~ right in round_down (it needs to be
589 * as wide as the result!), and we want to evaluate the macro

--- 177 unchanged lines hidden ---