From: Roy Zhan Date: Thu, 9 Apr 2015 03:03:34 +0000 (-0400) Subject: amdgpu/addrlib: add explicit Log2NonPow2 function X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c16e1e204184f65561fe4efe8238437caec074b8;p=mesa.git amdgpu/addrlib: add explicit Log2NonPow2 function --- diff --git a/src/amd/addrlib/core/addrcommon.h b/src/amd/addrlib/core/addrcommon.h index 019ebd07a29..0dff0b8cc47 100644 --- a/src/amd/addrlib/core/addrcommon.h +++ b/src/amd/addrlib/core/addrcommon.h @@ -445,22 +445,17 @@ static inline UINT_32 NextPow2( /** *************************************************************************************************** -* Log2 +* Log2NonPow2 * * @brief -* Compute log of base 2 +* Compute log of base 2 no matter the target is power of 2 or not *************************************************************************************************** */ -static inline UINT_32 Log2( +static inline UINT_32 Log2NonPow2( UINT_32 x) ///< [in] the value should calculate log based 2 { UINT_32 y; - // - // Assert that x is a power of two. - // - ADDR_ASSERT(IsPow2(x)); - y = 0; while (x > 1) { @@ -471,6 +466,23 @@ static inline UINT_32 Log2( return y; } +/** +*************************************************************************************************** +* Log2 +* +* @brief +* Compute log of base 2 +*************************************************************************************************** +*/ +static inline UINT_32 Log2( + UINT_32 x) ///< [in] the value should calculate log based 2 +{ + // Assert that x is a power of two. + ADDR_ASSERT(IsPow2(x)); + + return Log2NonPow2(x); +} + /** *************************************************************************************************** * QLog2