libcruft-util/maths.cpp
Danny Robson f6056153e3 rename root namespace from util to cruft
This places, at long last, the core library code into the same namespace
as the extended library code.
2018-08-05 14:42:02 +10:00

33 lines
939 B
C++

/*
* 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/.
*
* Copyright 2010-2014 Danny Robson <danny@nerdcruft.net>
*/
#include "maths.hpp"
#include <type_traits>
///////////////////////////////////////////////////////////////////////////////
template <typename T>
T
cruft::log2up (T v)
{
return log2 ((v << 1) - 1);
}
template uint32_t cruft::log2up (uint32_t);
template uint64_t cruft::log2up (uint64_t);
///////////////////////////////////////////////////////////////////////////////
// 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.
template float cruft::smoothstep (float, float, float);
template double cruft::smoothstep (double, double, double);