diff --git a/apps/launcher/graphicspage.cpp b/apps/launcher/graphicspage.cpp index 170f8a8e1c..56cd086807 100644 --- a/apps/launcher/graphicspage.cpp +++ b/apps/launcher/graphicspage.cpp @@ -1,11 +1,5 @@ #include "graphicspage.hpp" -#include -#if BOOST_VERSION >= 106500 -#include -#else -#include -#endif #include #include #include @@ -20,14 +14,11 @@ #include #include +#include QString getAspect(int x, int y) { -#if BOOST_VERSION >= 106500 - int gcd = boost::integer::gcd (x, y); -#else - int gcd = boost::math::gcd (x, y); -#endif + int gcd = Misc::gcd (x, y); int xaspect = x / gcd; int yaspect = y / gcd; // special case: 8 : 5 is usually referred to as 16:10 diff --git a/apps/openmw/mwgui/settingswindow.cpp b/apps/openmw/mwgui/settingswindow.cpp index 7a46f31899..ed36447383 100644 --- a/apps/openmw/mwgui/settingswindow.cpp +++ b/apps/openmw/mwgui/settingswindow.cpp @@ -8,16 +8,12 @@ #include #include -#if BOOST_VERSION >= 106500 -#include -#else -#include -#endif #include #include #include +#include #include #include @@ -63,11 +59,7 @@ namespace std::string getAspect (int x, int y) { -#if BOOST_VERSION >= 106500 - int gcd = boost::integer::gcd (x, y); -#else - int gcd = boost::math::gcd (x, y); -#endif + int gcd = Misc::gcd (x, y); int xaspect = x / gcd; int yaspect = y / gcd; // special case: 8 : 5 is usually referred to as 16:10 diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index d26a92d448..ed52c8111f 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -86,7 +86,7 @@ add_component_dir (esmterrain ) add_component_dir (misc - constants utf8stream stringops resourcehelpers rng messageformatparser weakcache + gcd constants utf8stream stringops resourcehelpers rng messageformatparser weakcache ) add_component_dir (debug diff --git a/components/misc/gcd.hpp b/components/misc/gcd.hpp new file mode 100644 index 0000000000..fd9e972e7a --- /dev/null +++ b/components/misc/gcd.hpp @@ -0,0 +1,13 @@ +#ifndef MISC_GCD_H +#define MISC_GCD_H + +namespace Misc +{ + // TODO: replace to the std::gcd() when the C++17 will be available. + int gcd(int a, int b) + { + return b == 0 ? a : gcd(b, a % b); + } +} + +#endif