1 /* -*- buffer-read-only: t -*- vi: set ro: */ 2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 3 /* MIN, MAX macros. 4 Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2011 Free Software 5 Foundation, Inc. 6 7 This program is free software; you can redistribute it and/or modify 8 it under the terms of the GNU General Public License as published by 9 the Free Software Foundation; either version 3, or (at your option) 10 any later version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program; if not, write to the Free Software Foundation, 19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ 20 21 #ifndef _MINMAX_H 22 #define _MINMAX_H 23 24 /* Note: MIN, MAX are also defined in <sys/param.h> on some systems 25 (glibc, IRIX, HP-UX, OSF/1). Therefore you might get warnings about 26 MIN, MAX macro redefinitions on some systems; the workaround is to 27 #include this file as the last one among the #include list. */ 28 29 /* Before we define the following symbols we get the <limits.h> file 30 since otherwise we get redefinitions on some systems if <limits.h> is 31 included after this file. Likewise for <sys/param.h>. 32 If more than one of these system headers define MIN and MAX, pick just 33 one of the headers (because the definitions most likely are the same). */ 34 #if HAVE_MINMAX_IN_LIMITS_H 35 # include <limits.h> 36 #elif HAVE_MINMAX_IN_SYS_PARAM_H 37 # include <sys/param.h> 38 #endif 39 40 /* Note: MIN and MAX should be used with two arguments of the 41 same type. They might not return the minimum and maximum of their two 42 arguments, if the arguments have different types or have unusual 43 floating-point values. For example, on a typical host with 32-bit 'int', 44 64-bit 'long long', and 64-bit IEEE 754 'double' types: 45 46 MAX (-1, 2147483648) returns 4294967295. 47 MAX (9007199254740992.0, 9007199254740993) returns 9007199254740992.0. 48 MAX (NaN, 0.0) returns 0.0. 49 MAX (+0.0, -0.0) returns -0.0. 50 51 and in each case the answer is in some sense bogus. */ 52 53 /* MAX(a,b) returns the maximum of A and B. */ 54 #ifndef MAX 55 # define MAX(a,b) ((a) > (b) ? (a) : (b)) 56 #endif 57 58 /* MIN(a,b) returns the minimum of A and B. */ 59 #ifndef MIN 60 # define MIN(a,b) ((a) < (b) ? (a) : (b)) 61 #endif 62 63 #endif /* _MINMAX_H */ 64