/****************************************************************************
 * This file was derived from the CNCL library by the Pablo research group.
 *
 * The complete CNCL library is available at:
 *       http://www.comnets.rwth-aachen.de/doc/cncl.html
 *
 * The CNCL copyright notice is included here:
 *
 * |_|_|_  |_|_    |_    |_|_|_  |_               C O M M U N I C A T I O N
 *|_       |_  |_  |_  |_        |_                         N E T W O R K S
 *|_       |_  |_  |_  |_        |_                               C L A S S
 * |_|_|_  |_    |_|_    |_|_|_  |_|_|_|_                     L I B R A R Y
 *
 *
 *
 * Copyright (C) 1992-1998   Communication Networks
 *                           Aachen University of Technology
 *                           D-52056 Aachen
 *                           Germany
 *                           Email: cncl-adm@comnets.rwth-aachen.de
 *
 *
 * This library is free  software; you can  redistribute it and/or modify
 * it  under   the terms  of the GNU   Library  General Public License as
 * published by the  Free Software Foundation;  either  version 2 of  the
 * License, or  (at  your option)  any  later  version.  This  library is
 * distributed  in the  hope  that  it  will  be useful,  but WITHOUT ANY
 * WARRANTY;  without even the   implied  warranty of MERCHANTABILITY  or
 * FITNESS FOR A PARTICULAR PURPOSE.   See the GNU Library General Public
 * Library General Public License along with  this library; if not, write
 * to the Free Software Foundation,  675  Mass Ave, Cambridge, MA  02139,
 * USA.
 ****************************************************************************/

//   -*- C++ -*-
/*****************************************************************************
 *
 * min(), max() functions header file
 *
 *****************************************************************************/

/*
Copyright (C) 1992 Free Software Foundation
    written by Doug Lea (dl@rocky.oswego.edu)

This file is part of the GNU C++ Library.  This library is free
software; you can redistribute it and/or modify it under the terms of
the GNU Library General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.  This library is distributed in the hope
that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.  See the GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#ifndef _minmax_h
#define _minmax_h 1

#ifdef __GNUG__
//# include <_G_config.h>
# ifdef  _G_BROKEN_SIGNED_CHAR
#  ifndef FuzzyLib_BROKEN_SIGNED_CHAR
#   define FuzzyLib_BROKEN_SIGNED_CHAR 1
#  endif
# endif
#endif


/*
 * Flmin()
 */
inline char Flmin(char a, char b)
{ return (a < b) ? a : b; }
#ifndef FuzzyLib_BROKEN_SIGNED_CHAR
inline signed char Flmin(signed char a, signed char b)
{ return (a < b) ? a : b; }
#endif
inline unsigned char Flmin(unsigned char a, unsigned char b)
{ return (a < b) ? a : b; }
inline short Flmin(short a, short b)
{ return (a < b) ? a : b; }
inline unsigned short Flmin(unsigned short a, unsigned short b)
{ return (a < b) ? a : b; }
inline int Flmin(int a, int b)
{ return (a < b) ? a : b; }
inline unsigned int Flmin(unsigned int a, unsigned int b)
{ return (a < b) ? a : b; }
inline long Flmin(long a, long b)
{ return (a < b) ? a : b; }
inline unsigned long Flmin(unsigned long a, unsigned long b)
{ return (a < b) ? a : b; }
inline float Flmin(float a, float b)
{ return (a < b) ? a : b; }
inline double Flmin(double a, double b)
{ return (a < b) ? a : b; }


/*
 * Flmax()
 */
inline char Flmax(char a, char b)
{ return (a > b) ? a : b;}
#ifndef  FuzzyLib_BROKEN_SIGNED_CHAR
inline signed char Flmax(signed char a, signed char b)
{ return (a > b) ? a : b;}
#endif
inline unsigned char Flmax(unsigned char a, unsigned char b)
{ return (a > b) ? a : b;}
inline short Flmax(short a, short b)
{ return (a > b) ? a : b;}
inline unsigned short Flmax(unsigned short a, unsigned short b)
{ return (a > b) ? a : b;}
inline int Flmax(int a, int b)
{ return (a > b) ? a : b;}
inline unsigned int Flmax(unsigned int a, unsigned int b)
{ return (a > b) ? a : b;}
inline long Flmax(long a, long b)
{ return (a > b) ? a : b;}
inline unsigned long Flmax(unsigned long a, unsigned long b)
{ return (a > b) ? a : b;}
inline float Flmax(float a, float b)
{ return (a > b) ? a : b;}
inline double Flmax(double a, double b)
{ return (a > b) ? a : b;}


/*
 * Flabs()
 */
/* commented out this one as SGI compiler complains that char is
 * unsigned therefore never < 0.
 *
 * inline char   Flabs(char   a)
 * { return a < 0 ? -a : a; }
 */
inline short  Flabs(short  a)
{ return a < 0 ? -a : a; }
inline int    Flabs(int    a)
{ return a < 0 ? -a : a; }
inline long   Flabs(long   a)
{ return a < 0 ? -a : a; }
inline float  Flabs(float  a)
{ return a < 0 ? -a : a; }
inline double Flabs(double a)
{ return a < 0 ? -a : a; }

#endif /**_minmax_h**/
