Mercator
iround.h
00001 // This file may be redistributed and modified only under the terms of
00002 // the GNU General Public License (See COPYING for details).
00003 // Copyright (C) 2003 Alistair Riddoch
00004 
00005 #ifndef MERCATOR_IROUND_H
00006 #define MERCATOR_IROUND_H
00007 
00008 #ifndef PACKAGE_NAME
00009 #error iround.h must be included after config.h
00010 #endif
00011 
00012 // FIXME tr1 contains std::tr1::lrint which is type overloaded
00013 // In c++0x this becomes std::lrint
00014 
00015 #ifdef HAVE_LRINTF
00016     #define I_ROUND(_x) (::lrintf(_x)) 
00017 #elif defined(HAVE_RINTF)
00018     #define I_ROUND(_x) ((int)::rintf(_x)) 
00019 #elif defined(HAVE_RINT)
00020     #define I_ROUND(_x) ((int)::rint(_x)) 
00021 #else
00022     #define I_ROUND(_x) ((int)(_x)) 
00023 #endif
00024 
00025 #endif // MERCATOR_IROUND_H