uhd/host/lib/include/uhdlib/utils/math.hpp
Martin Braun ae5211d71d uhd: Update license headers
All copyright is now attributed to "Ettus Research, a National
Instruments company".

SPDX headers were also updated to latest version 3.0.
2018-02-19 16:54:52 -08:00

25 lines
517 B
C++

//
// Copyright 2018 Ettus Research, a National Instruments Company
//
// SPDX-License-Identifier: GPL-3.0-or-later
//
// More math, but not meant for public API
#ifndef INCLUDED_UHDLIB_UTILS_MATH_HPP
#define INCLUDED_UHDLIB_UTILS_MATH_HPP
#include <cmath>
namespace uhd { namespace math {
/*! log2(num), rounded up to the nearest integer.
*/
template <class T>
T ceil_log2(T num){
return std::ceil(std::log(num)/std::log(T(2)));
}
}} /* namespace uhd::math */
#endif /* INCLUDED_UHDLIB_UTILS_MATH_HPP */