mirror of https://github.com/mosra/magnum.git
Browse Source
Math::pow() is templated on exponent, so it should be as fast as possible (without recursion).vectorfields
7 changed files with 67 additions and 1 deletions
@ -0,0 +1,27 @@
|
||||
/*
|
||||
Copyright © 2010, 2011 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
This file is part of Magnum. |
||||
|
||||
Magnum is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU Lesser General Public License version 3 |
||||
only, as published by the Free Software Foundation. |
||||
|
||||
Magnum is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU Lesser General Public License version 3 for more details. |
||||
*/ |
||||
|
||||
#include "Math.h" |
||||
|
||||
namespace Magnum { namespace Math { |
||||
|
||||
size_t log(size_t base, size_t number) { |
||||
size_t log = 0; |
||||
while(number /= base) |
||||
++log; |
||||
return log; |
||||
} |
||||
|
||||
}} |
||||
Loading…
Reference in new issue