Replace #if with if constexpr()
This allows to test the actual type, not something unrelated Change-Id: I82d0714f6355fc5ae7bd3205af3472a43f1f1051 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105998 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
@@ -60,13 +60,14 @@ static inline unsigned int highbit(sal_Size n)
|
|||||||
|
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return 0;
|
return 0;
|
||||||
#if SAL_TYPES_SIZEOFLONG == 8
|
if constexpr (sizeof(n) >= 8)
|
||||||
if (n & 0xffffffff00000000ul)
|
{
|
||||||
|
if (n & 0xffffffff00000000)
|
||||||
{
|
{
|
||||||
k |= 32;
|
k |= 32;
|
||||||
n >>= 32;
|
n >>= 32;
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
if (n & 0xffff0000)
|
if (n & 0xffff0000)
|
||||||
{
|
{
|
||||||
k |= 16;
|
k |= 16;
|
||||||
@@ -103,13 +104,14 @@ static inline unsigned int lowbit(sal_Size n)
|
|||||||
if (n == 0)
|
if (n == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#if SAL_TYPES_SIZEOFLONG == 8
|
if constexpr (sizeof(n) >= 8)
|
||||||
|
{
|
||||||
if (!(n & 0xffffffff))
|
if (!(n & 0xffffffff))
|
||||||
{
|
{
|
||||||
k |= 32;
|
k |= 32;
|
||||||
n >>= 32;
|
n >>= 32;
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
|
|
||||||
if (!(n & 0xffff))
|
if (!(n & 0xffff))
|
||||||
{
|
{
|
||||||
|
@@ -136,13 +136,14 @@ static int highbit(std::size_t n)
|
|||||||
|
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return 0;
|
return 0;
|
||||||
#if SAL_TYPES_SIZEOFLONG == 8
|
if constexpr (sizeof(n) == 8)
|
||||||
if (n & 0xffffffff00000000ul)
|
{
|
||||||
|
if (n & 0xffffffff00000000)
|
||||||
{
|
{
|
||||||
k |= 32;
|
k |= 32;
|
||||||
n >>= 32;
|
n >>= 32;
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
if (n & 0xffff0000)
|
if (n & 0xffff0000)
|
||||||
{
|
{
|
||||||
k |= 16;
|
k |= 16;
|
||||||
|
Reference in New Issue
Block a user