vrshoot

view libs/assimp/boost/math/common_factor_rt.hpp @ 2:334d17aed7de

visual studio project files
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 02 Feb 2014 18:36:38 +0200
parents
children
line source
3 #ifndef BOOST_MATH_COMMON_FACTOR_RT_HPP
4 #define BOOST_MATH_COMMON_FACTOR_RT_HPP
7 namespace boost {
8 namespace math {
10 // TODO: use binary GCD for unsigned integers ....
11 template < typename IntegerType >
12 IntegerType gcd( IntegerType a, IntegerType b )
13 {
14 const IntegerType zero = (IntegerType)0;
15 while ( true )
16 {
17 if ( a == zero )
18 return b;
19 b %= a;
21 if ( b == zero )
22 return a;
23 a %= b;
24 }
25 }
27 template < typename IntegerType >
28 IntegerType lcm( IntegerType a, IntegerType b )
29 {
30 const IntegerType t = gcd (a,b);
31 if (!t)return t;
32 return a / t * b;
33 }
35 }}
37 #endif