1 // This may look like C code, but it is really -*- C++ -*-
4 Copyright (C) 1988 Free Software Foundation
5 written by Doug Lea (dl@rocky.oswego.edu)
7 This file is part of GNU CC.
9 GNU CC is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY. No author or distributor
11 accepts responsibility to anyone for the consequences of using it
12 or for whether it serves any particular purpose or works at all,
13 unless he says so in writing. Refer to the GNU CC General Public
14 License for full details.
16 Everyone is granted permission to copy, modify and redistribute
17 GNU CC, but only under the conditions described in the
18 GNU CC General Public License. A copy of this license is
19 supposed to have been given to you along with GNU CC so you
20 can know your rights and responsibilities. It should be in a
21 file named COPYING. Among other things, the copyright notice
22 and this notice must be preserved on all copies.
34 int compare(int a
, int b
);
35 int compare(short a
, short b
);
36 int compare(char a
, char b
);
37 int compare(unsigned long a
, unsigned long b
);
38 int compare(unsigned int a
, unsigned int b
);
39 int compare(unsigned short a
, unsigned short b
);
40 int compare(unsigned char a
, unsigned char b
);
41 int compare(float a
, float b
);
42 int compare(double a
, double b
);
43 int compare(const char* a
, const char* b
);
45 #if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES)
47 inline int compare(int a
, int b
)
52 inline int compare(short a
, short b
)
57 inline int compare(char a
, char b
)
62 inline int compare(unsigned long a
, unsigned long b
)
64 return (a
< b
)? -1 : (a
> b
)? 1 : 0;
67 inline int compare(unsigned int a
, unsigned int b
)
69 return (a
< b
)? -1 : (a
> b
)? 1 : 0;
72 inline int compare(unsigned short a
, unsigned short b
)
74 return (a
< b
)? -1 : (a
> b
)? 1 : 0;
77 inline int compare(unsigned char a
, unsigned char b
)
79 return (a
< b
)? -1 : (a
> b
)? 1 : 0;
82 inline int compare(float a
, float b
)
84 return (a
< b
)? -1 : (a
> b
)? 1 : 0;
87 inline int compare(double a
, double b
)
89 return (a
< b
)? -1 : (a
> b
)? 1 : 0;
92 inline int compare(const char* a
, const char* b
)