mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-05 06:40:09 +00:00
Merge pull request #2200 from akortunov/warnfix
Replace boost GCD by the homebrew implementation
This commit is contained in:
commit
e7bf89d3d5
@ -1,11 +1,5 @@
|
|||||||
#include "graphicspage.hpp"
|
#include "graphicspage.hpp"
|
||||||
|
|
||||||
#include <boost/version.hpp>
|
|
||||||
#if BOOST_VERSION >= 106500
|
|
||||||
#include <boost/integer/common_factor.hpp>
|
|
||||||
#else
|
|
||||||
#include <boost/math/common_factor.hpp>
|
|
||||||
#endif
|
|
||||||
#include <csignal>
|
#include <csignal>
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
@ -20,14 +14,11 @@
|
|||||||
#include <SDL_video.h>
|
#include <SDL_video.h>
|
||||||
|
|
||||||
#include <components/files/configurationmanager.hpp>
|
#include <components/files/configurationmanager.hpp>
|
||||||
|
#include <components/misc/gcd.hpp>
|
||||||
|
|
||||||
QString getAspect(int x, int y)
|
QString getAspect(int x, int y)
|
||||||
{
|
{
|
||||||
#if BOOST_VERSION >= 106500
|
int gcd = Misc::gcd (x, y);
|
||||||
int gcd = boost::integer::gcd (x, y);
|
|
||||||
#else
|
|
||||||
int gcd = boost::math::gcd (x, y);
|
|
||||||
#endif
|
|
||||||
int xaspect = x / gcd;
|
int xaspect = x / gcd;
|
||||||
int yaspect = y / gcd;
|
int yaspect = y / gcd;
|
||||||
// special case: 8 : 5 is usually referred to as 16:10
|
// special case: 8 : 5 is usually referred to as 16:10
|
||||||
|
@ -8,16 +8,12 @@
|
|||||||
#include <MyGUI_TabControl.h>
|
#include <MyGUI_TabControl.h>
|
||||||
|
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
#if BOOST_VERSION >= 106500
|
|
||||||
#include <boost/integer/common_factor.hpp>
|
|
||||||
#else
|
|
||||||
#include <boost/math/common_factor.hpp>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <SDL_video.h>
|
#include <SDL_video.h>
|
||||||
|
|
||||||
#include <components/debug/debuglog.hpp>
|
#include <components/debug/debuglog.hpp>
|
||||||
#include <components/misc/stringops.hpp>
|
#include <components/misc/stringops.hpp>
|
||||||
|
#include <components/misc/gcd.hpp>
|
||||||
#include <components/widgets/sharedstatebutton.hpp>
|
#include <components/widgets/sharedstatebutton.hpp>
|
||||||
#include <components/settings/settings.hpp>
|
#include <components/settings/settings.hpp>
|
||||||
|
|
||||||
@ -63,11 +59,7 @@ namespace
|
|||||||
|
|
||||||
std::string getAspect (int x, int y)
|
std::string getAspect (int x, int y)
|
||||||
{
|
{
|
||||||
#if BOOST_VERSION >= 106500
|
int gcd = Misc::gcd (x, y);
|
||||||
int gcd = boost::integer::gcd (x, y);
|
|
||||||
#else
|
|
||||||
int gcd = boost::math::gcd (x, y);
|
|
||||||
#endif
|
|
||||||
int xaspect = x / gcd;
|
int xaspect = x / gcd;
|
||||||
int yaspect = y / gcd;
|
int yaspect = y / gcd;
|
||||||
// special case: 8 : 5 is usually referred to as 16:10
|
// special case: 8 : 5 is usually referred to as 16:10
|
||||||
|
@ -86,7 +86,7 @@ add_component_dir (esmterrain
|
|||||||
)
|
)
|
||||||
|
|
||||||
add_component_dir (misc
|
add_component_dir (misc
|
||||||
constants utf8stream stringops resourcehelpers rng messageformatparser weakcache
|
gcd constants utf8stream stringops resourcehelpers rng messageformatparser weakcache
|
||||||
)
|
)
|
||||||
|
|
||||||
add_component_dir (debug
|
add_component_dir (debug
|
||||||
|
13
components/misc/gcd.hpp
Normal file
13
components/misc/gcd.hpp
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user