diff --git a/code/IRRLoader.cpp b/code/IRRLoader.cpp index 2b95cbe6f..f0944ceb1 100644 --- a/code/IRRLoader.cpp +++ b/code/IRRLoader.cpp @@ -56,8 +56,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "StandardShapes.h" #include "Importer.h" -// We need boost::common_factor to compute the lcm/gcd of a number -#include +// We need Math.h to compute the lcm/gcd of a number +#include "Math.h" #include #include "../include/assimp/DefaultLogger.hpp" #include "../include/assimp/mesh.h" @@ -402,13 +402,13 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector +IntegerType gcd( IntegerType a, IntegerType b ) +{ + const IntegerType zero = (IntegerType)0; + while ( true ) + { + if ( a == zero ) + return b; + b %= a; + + if ( b == zero ) + return a; + a %= b; + } +} + +template < typename IntegerType > +IntegerType lcm( IntegerType a, IntegerType b ) +{ + const IntegerType t = gcd (a,b); + if (!t)return t; + return a / t * b; +} + +} +}