00001 /* 00002 This file is part of the CVD Library.00003 00004 Copyright (C) 2005 The Authors00005 00006 This library is free software; you can redistribute it and/or00007 modify it under the terms of the GNU Lesser General Public00008 License as published by the Free Software Foundation; either00009 version 2.1 of the License, or (at your option) any later version.00010 00011 This library is distributed in the hope that it will be useful,00012 but WITHOUT ANY WARRANTY; without even the implied warranty of00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU00014 Lesser General Public License for more details.00015 00016 You should have received a copy of the GNU Lesser General Public00017 License along with this library; if not, write to the Free Software00018 Foundation, Inc., 00019 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA00020 */00021 #ifndef CVD_ABS_H00022 #define CVD_ABS_H00023 00024namespace CVD
00025 {
00029 template <class T>
00030inline T abs(T t) { return t<0 ? -t : t; }
00034inlineunsignedcharabs(unsignedchar b) { return b; }
00038inlineunsignedshortabs(unsignedshort u) { return u; }
00042inlineunsignedintabs(unsignedint u) { return u; }
00046inlineunsignedlongabs(unsignedlong u) { return u; }
00047 }
00048 #endif00049