1 // inlines.h -- various inline template definitions
3 // Written by Norman Vine, started June 2000.
5 // Copyright (C) 2000 Norman Vine - nhv@cape.com
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 inline const int SG_SIGN(const T x) {
30 return x < T(0) ? -1 : 1;
34 inline const T SG_MIN(const T a, const T b) {
38 // return the minimum of three values
40 inline const T SG_MIN3( const T a, const T b, const T c) {
41 return (a < b ? SG_MIN (a, c) : SG_MIN (b, c));
45 inline const T SG_MAX(const T a, const T b) {
49 // return the maximum of three values
51 inline const T SG_MAX3 (const T a, const T b, const T c) {
52 return (a > b ? SG_MAX (a, c) : SG_MAX (b, c));
57 inline void SG_SWAP( T &a, T &b) {
58 T c = a; a = b; b = c;
61 #endif // _SG_INLINES_H