diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 16:57:03 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 16:57:03 +0200 |
commit | 420fb6c9b3427f65cfe24411944ee46b58cfcfb4 (patch) | |
tree | 58269ba5ee7a22d2df004f03b100cc234b8c3f14 /library/globalFunctions.h | |
parent | 1.16 (diff) | |
download | FreeFileSync-420fb6c9b3427f65cfe24411944ee46b58cfcfb4.tar.gz FreeFileSync-420fb6c9b3427f65cfe24411944ee46b58cfcfb4.tar.bz2 FreeFileSync-420fb6c9b3427f65cfe24411944ee46b58cfcfb4.zip |
1.17
Diffstat (limited to 'library/globalFunctions.h')
-rw-r--r-- | library/globalFunctions.h | 13 |
1 files changed, 9 insertions, 4 deletions
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<int>(d < 0 ? d - .5 : d + .5); + } template <class T> - 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 |