base: Tag API methods in intmath.hh
Change-Id: Ia50830c7620380ff2aba081f56f74822aff982bf Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33075 Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu> Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
This commit is contained in:
@@ -36,6 +36,9 @@
|
||||
#include "base/logging.hh"
|
||||
#include "base/types.hh"
|
||||
|
||||
/**
|
||||
* @ingroup api_base_utils
|
||||
*/
|
||||
inline uint64_t
|
||||
power(uint32_t n, uint32_t e)
|
||||
{
|
||||
@@ -52,6 +55,9 @@ power(uint32_t n, uint32_t e)
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup api_base_utils
|
||||
*/
|
||||
template <class T>
|
||||
inline typename std::enable_if<std::is_integral<T>::value, int>::type
|
||||
floorLog2(T x)
|
||||
@@ -74,6 +80,9 @@ floorLog2(T x)
|
||||
return y;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup api_base_utils
|
||||
*/
|
||||
template <class T>
|
||||
inline int
|
||||
ceilLog2(const T& n)
|
||||
@@ -85,6 +94,9 @@ ceilLog2(const T& n)
|
||||
return floorLog2(n - (T)1) + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup api_base_utils
|
||||
*/
|
||||
template <class T>
|
||||
inline bool
|
||||
isPowerOf2(const T& n)
|
||||
@@ -94,6 +106,9 @@ isPowerOf2(const T& n)
|
||||
return n && !(n & (n - 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup api_base_utils
|
||||
*/
|
||||
template <class T, class U>
|
||||
inline T
|
||||
divCeil(const T& a, const U& b)
|
||||
@@ -108,7 +123,9 @@ divCeil(const T& a, const U& b)
|
||||
* @param align is the alignment. Can only be a power of 2.
|
||||
* @return The aligned address. The smallest number divisible
|
||||
* by @param align which is greater than or equal to @param val.
|
||||
*/
|
||||
*
|
||||
* @ingroup api_base_utils
|
||||
*/
|
||||
template <class T, class U>
|
||||
inline T
|
||||
roundUp(const T& val, const U& align)
|
||||
@@ -125,7 +142,9 @@ roundUp(const T& val, const U& align)
|
||||
* @param align is the alignment. Can only be a power of 2.
|
||||
* @return The aligned address. The biggest number divisible
|
||||
* by @param align which is less than or equal to @param val.
|
||||
*/
|
||||
*
|
||||
* @ingroup api_base_utils
|
||||
*/
|
||||
template <class T, class U>
|
||||
inline T
|
||||
roundDown(const T& val, const U& align)
|
||||
|
||||
Reference in New Issue
Block a user