summaryrefslogtreecommitdiff
path: root/src/amd/addrlib
diff options
context:
space:
mode:
authorRoy Zhan <roy.zhan@amd.com>2015-04-08 23:03:34 -0400
committerMarek Olšák <marek.olsak@amd.com>2017-03-30 14:44:33 +0200
commitc16e1e204184f65561fe4efe8238437caec074b8 (patch)
tree17a632870c43d2db4dea41964ab443b7d92650ae /src/amd/addrlib
parent4a4b7da141834c6bcdbab7da7dd8599fab400b04 (diff)
amdgpu/addrlib: add explicit Log2NonPow2 function
Diffstat (limited to 'src/amd/addrlib')
-rw-r--r--src/amd/addrlib/core/addrcommon.h28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/amd/addrlib/core/addrcommon.h b/src/amd/addrlib/core/addrcommon.h
index 019ebd07a2..0dff0b8cc4 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)
{
@@ -473,6 +468,23 @@ static inline UINT_32 Log2(
/**
***************************************************************************************************
+* 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
*
* @brief