home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / libg++-2.7.1-bin.lha / lib / g++-include / minmax.h < prev    next >
C/C++ Source or Header  |  1996-10-12  |  2KB  |  66 lines

  1. /*
  2. Copyright (C) 1992 Free Software Foundation
  3.     written by Doug Lea (dl@rocky.oswego.edu)
  4.  
  5. This file is part of the GNU C++ Library.  This library is free
  6. software; you can redistribute it and/or modify it under the terms of
  7. the GNU Library General Public License as published by the Free
  8. Software Foundation; either version 2 of the License, or (at your
  9. option) any later version.  This library is distributed in the hope
  10. that it will be useful, but WITHOUT ANY WARRANTY; without even the
  11. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  12. PURPOSE.  See the GNU Library General Public License for more details.
  13. You should have received a copy of the GNU Library General Public
  14. License along with this library; if not, write to the Free Software
  15. Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  16. */
  17.  
  18. #ifndef _minmax_h
  19. #ifdef _GNUG_
  20. #pragma interface
  21. #endif
  22. #define _minmax_h 1
  23.  
  24. #include <_G_config.h>
  25.  
  26. inline char min(char a, char b) { return (a < b)?a:b;}
  27. #ifndef  _G_BROKEN_SIGNED_CHAR
  28. inline signed char min(signed char a, signed char b) { return (a < b)?a:b;}
  29. #endif
  30. inline unsigned char min(unsigned char a, unsigned char b) {return (a<b)?a:b;}
  31.  
  32. inline short min(short a, short b) {return (a < b) ?a:b;}
  33. inline unsigned short min(unsigned short a, unsigned short b) {return (a < b)?a:b;}
  34.  
  35. inline int min(int a, int b) {return (a < b)?a:b;}
  36. inline unsigned int min(unsigned int a, unsigned int b) {return (a < b)?a:b;}
  37.  
  38. inline long min(long a, long b) {return (a < b)?a:b;}
  39. inline unsigned long min(unsigned long a, unsigned long b) {return (a<b)?a:b;}
  40.  
  41. inline float min(float a, float b) {return (a < b)?a:b;}
  42.  
  43. inline double min(double a, double b) {return (a < b)?a:b;}
  44.  
  45. inline char max(char a, char b) { return (a > b)?a:b;}
  46. #ifndef  _G_BROKEN_SIGNED_CHAR
  47. inline signed char max(signed char a, signed char b) {return (a > b)?a:b;}
  48. #endif
  49. inline unsigned char max(unsigned char a, unsigned char b) {return (a>b)?a:b;}
  50.  
  51. inline short max(short a, short b) {return (a > b) ?a:b;}
  52. inline unsigned short max(unsigned short a, unsigned short b) {return (a > b)?a:b;}
  53.  
  54. inline int max(int a, int b) {return (a > b)?a:b;}
  55. inline unsigned int max(unsigned int a, unsigned int b) {return (a > b)?a:b;}
  56.  
  57. inline long max(long a, long b) {return (a > b)?a:b;}
  58. inline unsigned long max(unsigned long a, unsigned long b) {return (a>b)?a:b;}
  59.  
  60. inline float max(float a, float b) {return (a > b)?a:b;}
  61.  
  62. inline double max(double a, double b) {return (a > b)?a:b;}
  63.  
  64. #endif
  65.  
  66.