2011-05-23 17:18:52 +10:00
|
|
|
/*
|
2018-08-04 15:14:06 +10:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2011-05-23 17:18:52 +10:00
|
|
|
*
|
2014-09-17 18:20:28 +10:00
|
|
|
* Copyright 2010-2014 Danny Robson <danny@nerdcruft.net>
|
2011-05-23 17:18:52 +10:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "maths.hpp"
|
|
|
|
|
2011-08-29 14:31:22 +10:00
|
|
|
#include <type_traits>
|
2011-05-23 17:18:52 +10:00
|
|
|
|
|
|
|
|
2015-11-13 17:25:21 +11:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2014-09-17 16:41:38 +10:00
|
|
|
template <typename T>
|
|
|
|
T
|
2015-11-16 11:42:20 +11:00
|
|
|
util::log2up (T v)
|
2014-09-17 16:41:38 +10:00
|
|
|
{
|
|
|
|
return log2 ((v << 1) - 1);
|
|
|
|
}
|
|
|
|
|
2015-11-16 11:42:20 +11:00
|
|
|
template uint32_t util::log2up (uint32_t);
|
|
|
|
template uint64_t util::log2up (uint64_t);
|
2014-09-17 16:41:38 +10:00
|
|
|
|
|
|
|
|
2015-11-13 17:25:21 +11:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2015-02-05 20:30:33 +11:00
|
|
|
// Simple instantiations. Some functions aren't used internally to the library
|
|
|
|
// so it's easier to instantiate early and check for broken code at library
|
|
|
|
// build time.
|
|
|
|
|
2015-11-16 11:42:20 +11:00
|
|
|
template float util::smoothstep (float, float, float);
|
|
|
|
template double util::smoothstep (double, double, double);
|