~diresu/blender/blender-command-port

« back to all changes in this revision

Viewing changes to intern/moto/include/MT_MinMax.h

  • Committer: theeth
  • Date: 2008-10-14 16:52:04 UTC
  • Revision ID: vcs-imports@canonical.com-20081014165204-r32w2gm6s0osvdhn
copy back trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * $Id: MT_MinMax.h 14444 2008-04-16 22:40:48Z hos $
 
3
 * ***** BEGIN GPL LICENSE BLOCK *****
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or
 
6
 * modify it under the terms of the GNU General Public License
 
7
 * as published by the Free Software Foundation; either version 2
 
8
 * of the License, or (at your option) any later version.
 
9
 *
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program; if not, write to the Free Software Foundation,
 
17
 * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
18
 *
 
19
 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
 
20
 * All rights reserved.
 
21
 *
 
22
 * The Original Code is: all of this file.
 
23
 *
 
24
 * Contributor(s): none yet.
 
25
 *
 
26
 * ***** END GPL LICENSE BLOCK *****
 
27
 */
 
28
 
 
29
/*
 
30
 
 
31
 * Copyright (c) 2000 Gino van den Bergen <gino@acm.org>
 
32
 *
 
33
 * Permission to use, copy, modify, distribute and sell this software
 
34
 * and its documentation for any purpose is hereby granted without fee,
 
35
 * provided that the above copyright notice appear in all copies and
 
36
 * that both that copyright notice and this permission notice appear
 
37
 * in supporting documentation.  Gino van den Bergen makes no
 
38
 * representations about the suitability of this software for any
 
39
 * purpose.  It is provided "as is" without express or implied warranty.
 
40
 *
 
41
 */
 
42
 
 
43
#ifndef MT_MINMAX_H
 
44
#define MT_MINMAX_H
 
45
 
 
46
template <class T>
 
47
inline const T& MT_min(const T& a, const T& b) {
 
48
  return b < a ? b : a;
 
49
}
 
50
 
 
51
template <class T>
 
52
inline const T& MT_max(const T& a, const T& b) {
 
53
  return  a < b ? b : a;
 
54
}
 
55
 
 
56
template <class T>
 
57
inline void MT_set_min(T& a, const T& b) {
 
58
    if (a > b) a = b;
 
59
}
 
60
 
 
61
template <class T>
 
62
inline void MT_set_max(T& a, const T& b) {
 
63
    if (a < b) a = b;
 
64
}
 
65
 
 
66
#endif
 
67