Clang compat

This commit is contained in:
Mattias Jansson
2024-05-12 21:14:44 +02:00
parent 137bc8451c
commit f92bf85224
2 changed files with 5 additions and 5 deletions

View File

@@ -131,12 +131,12 @@ extern inline void* RPMALLOC_CDECL pvalloc(size_t size) { return rppvalloc(size)
extern inline void* RPMALLOC_CDECL reallocarray(void* ptr, size_t count, size_t size) { return rpreallocarray(ptr, count, size); }
#ifdef _WIN32
extern inline RPMALLOC_RESTRICT void* RPMALLOC_CDECL _malloc_base(size_t size) { return rpmalloc(size); }
extern inline void* RPMALLOC_CDECL _malloc_base(size_t size) { return rpmalloc(size); }
extern inline void RPMALLOC_CDECL _free_base(void* ptr) { rpfree(ptr); }
extern inline RPMALLOC_RESTRICT void* RPMALLOC_CDECL _calloc_base(size_t count, size_t size) { return rpcalloc(count, size); }
extern inline void* RPMALLOC_CDECL _calloc_base(size_t count, size_t size) { return rpcalloc(count, size); }
extern inline size_t RPMALLOC_CDECL _msize(void* ptr) { return rpmalloc_usable_size(ptr); }
extern inline size_t RPMALLOC_CDECL _msize_base(void* ptr) { return rpmalloc_usable_size(ptr); }
extern inline RPMALLOC_RESTRICT void* RPMALLOC_CDECL _realloc_base(void* ptr, size_t size) { return rprealloc(ptr, size); }
extern inline void* RPMALLOC_CDECL _realloc_base(void* ptr, size_t size) { return rprealloc(ptr, size); }
#endif
#ifdef _WIN32

View File

@@ -264,13 +264,13 @@ static rpmalloc_statistics_t global_statistics;
static inline size_t
rpmalloc_clz(uintptr_t x) {
#if ARCH_64BIT
#if defined(_MSC_VER)
#if defined(_MSC_VER) && !defined(__clang__)
return (size_t)_lzcnt_u64(x);
#else
return (size_t)__builtin_clzll(x);
#endif
#else
#if defined(_MSC_VER)
#if defined(_MSC_VER) && !defined(__clang__)
return (size_t)_lzcnt_u32(x);
#else
return (size_t)__builtin_clzl(x);