xref: /dragonfly/contrib/lvm2/dist/lib/misc/util.h (revision 9348a738)
1 /*	$NetBSD: util.h,v 1.1.1.1 2008/12/22 00:18:13 haad Exp $	*/
2 
3 /*
4  * Copyright (C) 2007 Red Hat, Inc. All rights reserved.
5  *
6  * This file is part of LVM2.
7  *
8  * This copyrighted material is made available to anyone wishing to use,
9  * modify, copy, or redistribute it subject to the terms and conditions
10  * of the GNU Lesser General Public License v.2.1.
11  *
12  * You should have received a copy of the GNU Lesser General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
15  */
16 
17 #ifndef _LVM_UTIL_H
18 #define _LVM_UTIL_H
19 
20 #define min(a, b) ({ typeof(a) _a = (a); \
21 		     typeof(b) _b = (b); \
22 		     (void) (&_a == &_b); \
23 		     _a < _b ? _a : _b; })
24 
25 #define max(a, b) ({ typeof(a) _a = (a); \
26 		     typeof(b) _b = (b); \
27 		     (void) (&_a == &_b); \
28 		     _a > _b ? _a : _b; })
29 
30 #define uninitialized_var(x) x = x
31 
32 #endif
33