mirror of
https://github.com/saymrwulf/uhd.git
synced 2026-05-16 21:10:10 +00:00
All copyright is now attributed to "Ettus Research, a National Instruments company". SPDX headers were also updated to latest version 3.0.
25 lines
517 B
C++
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 */
|