00001 /*<std-header orig-src='shore' incl-file-exclusion='W_MINMAX_H'> 00002 00003 $Id: w_minmax.h,v 1.20 2010/05/26 01:20:25 nhall Exp $ 00004 00005 SHORE -- Scalable Heterogeneous Object REpository 00006 00007 Copyright (c) 1994-99 Computer Sciences Department, University of 00008 Wisconsin -- Madison 00009 All Rights Reserved. 00010 00011 Permission to use, copy, modify and distribute this software and its 00012 documentation is hereby granted, provided that both the copyright 00013 notice and this permission notice appear in all copies of the 00014 software, derivative works or modified versions, and any portions 00015 thereof, and that both notices appear in supporting documentation. 00016 00017 THE AUTHORS AND THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY 00018 OF WISCONSIN - MADISON ALLOW FREE USE OF THIS SOFTWARE IN ITS 00019 "AS IS" CONDITION, AND THEY DISCLAIM ANY LIABILITY OF ANY KIND 00020 FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 00021 00022 This software was developed with support by the Advanced Research 00023 Project Agency, ARPA order number 018 (formerly 8230), monitored by 00024 the U.S. Army Research Laboratory under contract DAAB07-91-C-Q518. 00025 Further funding for this work was provided by DARPA through 00026 Rome Research Laboratory Contract No. F30602-97-2-0247. 00027 00028 */ 00029 00030 #ifndef W_MINMAX_H 00031 #define W_MINMAX_H 00032 00033 #include "w_defines.h" 00034 00035 /* -- do not edit anything above this line -- </std-header>*/ 00036 00037 #if !defined(GNUG_BUG_14) 00038 00039 // WARNING: due to a gcc 2.6.* bug, do not used these 00040 // since there is no way to explicitly instantiate 00041 // function templates. 00042 00043 template <class T> 00044 inline const T 00045 max(const T x, const T y) 00046 { 00047 return x > y ? x : y; 00048 } 00049 00050 template <class T> 00051 inline const T 00052 min(const T x, const T y) 00053 { 00054 return x < y ? x : y; 00055 } 00056 #endif /* !__GNUC__ */ 00057 00058 #ifdef W_UNIX 00059 #if HAVE_SYS_PARAM_H 00060 #include <sys/param.h> 00061 #endif 00062 /* 00063 // on some systems, <sys/param.h> defines 00064 // MIN & MAX; it invariably gets included 00065 // after this, and we get annoying warnings. 00066 // Let us include it first, and get it out 00067 // of the way. 00068 */ 00069 #endif 00070 00071 #ifndef MAX 00072 #define MAX(x, y) ((x) > (y) ? (x) : (y)) 00073 #endif /*MAX*/ 00074 00075 #ifndef MIN 00076 #define MIN(x, y) ((x) < (y) ? (x) : (y)) 00077 #endif /*MIN*/ 00078 00079 /*<std-footer incl-file-exclusion='W_MINMAX_H'> -- do not edit anything below this line -- */ 00080 00081 #endif /*</std-footer>*/