diff options
author | bugaevskiy <bugaevskiy@yandex-team.ru> | 2022-02-10 16:46:17 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:17 +0300 |
commit | a6e0145a095c7bb3770d6e07aee301de5c73f96e (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /contrib/libs/jemalloc/include/msvc_compat | |
parent | c7f68570483e493f4ddaf946de7b3a420ee621b0 (diff) | |
download | ydb-a6e0145a095c7bb3770d6e07aee301de5c73f96e.tar.gz |
Restoring authorship annotation for <bugaevskiy@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/jemalloc/include/msvc_compat')
-rw-r--r-- | contrib/libs/jemalloc/include/msvc_compat/strings.h | 92 | ||||
-rw-r--r-- | contrib/libs/jemalloc/include/msvc_compat/windows_extra.h | 12 |
2 files changed, 52 insertions, 52 deletions
diff --git a/contrib/libs/jemalloc/include/msvc_compat/strings.h b/contrib/libs/jemalloc/include/msvc_compat/strings.h index 73cffe5399..996f256ce8 100644 --- a/contrib/libs/jemalloc/include/msvc_compat/strings.h +++ b/contrib/libs/jemalloc/include/msvc_compat/strings.h @@ -3,56 +3,56 @@ /* MSVC doesn't define ffs/ffsl. This dummy strings.h header is provided * for both */ -#ifdef _MSC_VER -# include <intrin.h> -# pragma intrinsic(_BitScanForward) -static __forceinline int ffsl(long x) { +#ifdef _MSC_VER +# include <intrin.h> +# pragma intrinsic(_BitScanForward) +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) { - 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 +static __forceinline int ffs(int x) { + return ffsl(x); } -#else -# define ffsll(x) __builtin_ffsll(x) -# define ffsl(x) __builtin_ffsl(x) -# define ffs(x) __builtin_ffs(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 - -#endif /* strings_h */ +} + +#else +# define ffsll(x) __builtin_ffsll(x) +# define ffsl(x) __builtin_ffsl(x) +# define ffs(x) __builtin_ffs(x) +#endif + +#endif /* strings_h */ diff --git a/contrib/libs/jemalloc/include/msvc_compat/windows_extra.h b/contrib/libs/jemalloc/include/msvc_compat/windows_extra.h index 21e5482881..a6ebb9306f 100644 --- a/contrib/libs/jemalloc/include/msvc_compat/windows_extra.h +++ b/contrib/libs/jemalloc/include/msvc_compat/windows_extra.h @@ -1,6 +1,6 @@ -#ifndef MSVC_COMPAT_WINDOWS_EXTRA_H -#define MSVC_COMPAT_WINDOWS_EXTRA_H - -#include <errno.h> - -#endif /* MSVC_COMPAT_WINDOWS_EXTRA_H */ +#ifndef MSVC_COMPAT_WINDOWS_EXTRA_H +#define MSVC_COMPAT_WINDOWS_EXTRA_H + +#include <errno.h> + +#endif /* MSVC_COMPAT_WINDOWS_EXTRA_H */ |