"Fossies" - the Fresh Open Source Software Archive

Member "qdiff-0.9.1/tminmax.h" (21 Oct 2008, 1353 Bytes) of package /linux/privat/old/qdiff-0.9.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /*GPL*START*
    2  * 
    3  * Copyright (C) 1998 by Johannes Overmann <overmann@iname.com>
    4  * Copyright (C) 2008 by Tong Sun <suntong001@users.sourceforge.net>
    5  * 
    6  * This program is free software; you can redistribute it and/or modify
    7  * it under the terms of the GNU General Public License as published by
    8  * the Free Software Foundation; either version 2 of the License, or
    9  * (at your option) any later version.
   10  * 
   11  * This program is distributed in the hope that it will be useful,
   12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   14  * GNU General Public License for more details.
   15  * 
   16  * You should have received a copy of the GNU General Public License along
   17  * with this program; if not, write to the Free Software Foundation, Inc.,
   18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
   19  * *GPL*END*/  
   20 
   21 #ifndef _ngw_tminmax_h_
   22 #define _ngw_tminmax_h_
   23 
   24 template<class T> inline T tMin(const T& a, const T& b) {return a<=b?a:b;}
   25 template<class T> inline T tMax(const T& a, const T& b) {return a>=b?a:b;}
   26 template<class T> inline T tAbs(const T& a) {return a>=0?a:-a;}
   27 
   28 template<class T> inline bool tOutOfRange(const T& value, 
   29                      const T& lower, 
   30                      const T& upper) {
   31    if((value<lower) || (value>upper)) return true; else return false;}
   32 
   33 #endif // _minmax_h_