diff --git a/src/Math/Math.cpp b/src/Math/Math.cpp index 5c2560a21..56a7636eb 100644 --- a/src/Math/Math.cpp +++ b/src/Math/Math.cpp @@ -15,10 +15,12 @@ #include "Math.h" +using namespace std; + namespace Magnum { namespace Math { -size_t log(size_t base, size_t number) { - size_t log = 0; +uint32_t log(uint32_t base, uint32_t number) { + uint32_t log = 0; while(number /= base) ++log; return log; diff --git a/src/Math/Math.h b/src/Math/Math.h index 47f345327..07ebea111 100644 --- a/src/Math/Math.h +++ b/src/Math/Math.h @@ -37,7 +37,7 @@ namespace Magnum { namespace Math { #ifndef DOXYGEN_GENERATING_OUTPUT namespace Implementation { - template struct Pow { + template struct Pow { template inline constexpr T operator()(T base) const { return base*Pow()(base); } @@ -53,7 +53,7 @@ namespace Implementation { * * Returns integral power of base to the exponent. */ -template inline constexpr T pow(T base) { +template inline constexpr T pow(T base) { return Implementation::Pow()(base); } @@ -62,7 +62,7 @@ template inline constexpr T pow(T base) { * * Returns integral logarithm of given number with given base. */ -size_t MAGNUM_EXPORT log(size_t base, size_t number); +std::uint32_t MAGNUM_EXPORT log(std::uint32_t base, std::uint32_t number); /** @brief Normalize floating-point value diff --git a/src/SizeTraits.h b/src/SizeTraits.h index 4d4b28c09..fe5c3c8d9 100644 --- a/src/SizeTraits.h +++ b/src/SizeTraits.h @@ -143,14 +143,14 @@ template struct SizeBasedCall: public Base { Useful mainly for computing template parameter value, e.g. in conjunction with SizeTraits class. */ -template struct Pow { +template struct Pow { /** @brief Value of the power */ - enum { value = base*Pow::value }; + enum: std::uint32_t { value = base*Pow::value }; }; #ifndef DOXYGEN_GENERATING_OUTPUT -template struct Pow { - enum { value = 1 }; +template struct Pow { + enum: std::uint32_t { value = 1 }; }; #endif @@ -162,15 +162,15 @@ template struct Pow { Useful mainly for computing template parameter value, e.g. in conjunction with SizeTraits class. */ -template struct Log { +template struct Log { /** @brief Value of the logarithm */ - enum { value = 1+Log::value }; + enum: std::uint32_t { value = 1+Log::value }; }; #ifndef DOXYGEN_GENERATING_OUTPUT -template struct Log: public Log {}; -template struct Log { - enum { value = 0 }; +template struct Log: public Log {}; +template struct Log { + enum: std::uint32_t { value = 0 }; }; #endif