From 420fb6c9b3427f65cfe24411944ee46b58cfcfb4 Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 16:57:03 +0200 Subject: 1.17 --- library/globalFunctions.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'library/globalFunctions.h') diff --git a/library/globalFunctions.h b/library/globalFunctions.h index b4ccba5c..98e8cd1c 100644 --- a/library/globalFunctions.h +++ b/library/globalFunctions.h @@ -13,12 +13,17 @@ namespace globalFunctions { - int round(double d); //little rounding function + inline + int round(double d) //little rounding function + { + return static_cast(d < 0 ? d - .5 : d + .5); + } template - T abs(const T& d) //absolute value + inline + T abs(const T& d) //absolute value { - return(d<0?-d:d); + return(d < 0 ? -d : d); } std::string numberToString(const unsigned int number); //convert number to string @@ -35,7 +40,7 @@ namespace globalFunctions int wxStringToInt( const wxString& number); //convert wxString to number double wxStringToDouble(const wxString& number); //convert wxString to number - wxString& includeNumberSeparator(wxString& number); + wxString includeNumberSeparator(const wxString& number); int readInt(std::ifstream& stream); //read int from file stream void writeInt(std::ofstream& stream, const int number); //write int to filestream -- cgit