mirror of
https://github.com/fluencelabs/redis
synced 2025-07-31 00:11:56 +00:00
Jemalloc upgraded to version 5.0.1.
This commit is contained in:
45
deps/jemalloc/include/msvc_compat/strings.h
vendored
45
deps/jemalloc/include/msvc_compat/strings.h
vendored
@@ -6,22 +6,51 @@
|
||||
#ifdef _MSC_VER
|
||||
# include <intrin.h>
|
||||
# pragma intrinsic(_BitScanForward)
|
||||
static __forceinline int ffsl(long x)
|
||||
{
|
||||
static __forceinline int ffsl(long x) {
|
||||
unsigned long i;
|
||||
|
||||
if (_BitScanForward(&i, x))
|
||||
return (i + 1);
|
||||
return (0);
|
||||
if (_BitScanForward(&i, x)) {
|
||||
return i + 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __forceinline int ffs(int x)
|
||||
{
|
||||
static __forceinline int ffs(int x) {
|
||||
return ffsl(x);
|
||||
}
|
||||
|
||||
return (ffsl(x));
|
||||
# ifdef _M_X64
|
||||
# pragma intrinsic(_BitScanForward64)
|
||||
# endif
|
||||
|
||||
static __forceinline int ffsll(unsigned __int64 x) {
|
||||
unsigned long i;
|
||||
#ifdef _M_X64
|
||||
if (_BitScanForward64(&i, x)) {
|
||||
return i + 1;
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
// Fallback for 32-bit build where 64-bit version not available
|
||||
// assuming little endian
|
||||
union {
|
||||
unsigned __int64 ll;
|
||||
unsigned long l[2];
|
||||
} s;
|
||||
|
||||
s.ll = x;
|
||||
|
||||
if (_BitScanForward(&i, s.l[0])) {
|
||||
return i + 1;
|
||||
} else if(_BitScanForward(&i, s.l[1])) {
|
||||
return i + 33;
|
||||
}
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#else
|
||||
# define ffsll(x) __builtin_ffsll(x)
|
||||
# define ffsl(x) __builtin_ffsl(x)
|
||||
# define ffs(x) __builtin_ffs(x)
|
||||
#endif
|
||||
|
@@ -1,26 +1,6 @@
|
||||
#ifndef MSVC_COMPAT_WINDOWS_EXTRA_H
|
||||
#define MSVC_COMPAT_WINDOWS_EXTRA_H
|
||||
#define MSVC_COMPAT_WINDOWS_EXTRA_H
|
||||
|
||||
#ifndef ENOENT
|
||||
# define ENOENT ERROR_PATH_NOT_FOUND
|
||||
#endif
|
||||
#ifndef EINVAL
|
||||
# define EINVAL ERROR_BAD_ARGUMENTS
|
||||
#endif
|
||||
#ifndef EAGAIN
|
||||
# define EAGAIN ERROR_OUTOFMEMORY
|
||||
#endif
|
||||
#ifndef EPERM
|
||||
# define EPERM ERROR_WRITE_FAULT
|
||||
#endif
|
||||
#ifndef EFAULT
|
||||
# define EFAULT ERROR_INVALID_ADDRESS
|
||||
#endif
|
||||
#ifndef ENOMEM
|
||||
# define ENOMEM ERROR_NOT_ENOUGH_MEMORY
|
||||
#endif
|
||||
#ifndef ERANGE
|
||||
# define ERANGE ERROR_INVALID_DATA
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
#endif /* MSVC_COMPAT_WINDOWS_EXTRA_H */
|
||||
|
Reference in New Issue
Block a user