[Libreoffice-commits] core.git: sal/rtl store/source
Mike Kaganski (via logerrit)
logerrit at kemper.freedesktop.org
Wed Nov 18 14:19:05 UTC 2020
sal/rtl/alloc_impl.hxx | 22 ++++++++++++----------
store/source/storcach.cxx | 11 ++++++-----
2 files changed, 18 insertions(+), 15 deletions(-)
New commits:
commit d9af7ac4d697be1d520ea751eb7f8fc77a2ca03e
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Wed Nov 18 10:24:08 2020 +0100
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Wed Nov 18 15:18:25 2020 +0100
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 at collabora.com>
diff --git a/sal/rtl/alloc_impl.hxx b/sal/rtl/alloc_impl.hxx
index bdacba04a29d..29c24cc998d7 100644
--- a/sal/rtl/alloc_impl.hxx
+++ b/sal/rtl/alloc_impl.hxx
@@ -60,13 +60,14 @@ static inline unsigned int highbit(sal_Size n)
if (n == 0)
return 0;
-#if SAL_TYPES_SIZEOFLONG == 8
- if (n & 0xffffffff00000000ul)
+ if constexpr (sizeof(n) >= 8)
{
- k |= 32;
- n >>= 32;
+ if (n & 0xffffffff00000000)
+ {
+ k |= 32;
+ n >>= 32;
+ }
}
-#endif
if (n & 0xffff0000)
{
k |= 16;
@@ -103,13 +104,14 @@ static inline unsigned int lowbit(sal_Size n)
if (n == 0)
return 0;
-#if SAL_TYPES_SIZEOFLONG == 8
- if (!(n & 0xffffffff))
+ if constexpr (sizeof(n) >= 8)
{
- k |= 32;
- n >>= 32;
+ if (!(n & 0xffffffff))
+ {
+ k |= 32;
+ n >>= 32;
+ }
}
-#endif
if (!(n & 0xffff))
{
diff --git a/store/source/storcach.cxx b/store/source/storcach.cxx
index c3db00d21f84..cefd963813a6 100644
--- a/store/source/storcach.cxx
+++ b/store/source/storcach.cxx
@@ -136,13 +136,14 @@ static int highbit(std::size_t n)
if (n == 0)
return 0;
-#if SAL_TYPES_SIZEOFLONG == 8
- if (n & 0xffffffff00000000ul)
+ if constexpr (sizeof(n) == 8)
{
- k |= 32;
- n >>= 32;
+ if (n & 0xffffffff00000000)
+ {
+ k |= 32;
+ n >>= 32;
+ }
}
-#endif
if (n & 0xffff0000)
{
k |= 16;
More information about the Libreoffice-commits
mailing list