mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-23 21:23:06 +00:00
Reformat the codebase with the clang-format 18.
This commit is contained in:
@@ -4,9 +4,10 @@
|
||||
/* 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) {
|
||||
# include <intrin.h>
|
||||
# pragma intrinsic(_BitScanForward)
|
||||
static __forceinline int
|
||||
ffsl(long x) {
|
||||
unsigned long i;
|
||||
|
||||
if (_BitScanForward(&i, x)) {
|
||||
@@ -15,44 +16,46 @@ static __forceinline int ffsl(long x) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __forceinline int ffs(int x) {
|
||||
static __forceinline int
|
||||
ffs(int x) {
|
||||
return ffsl(x);
|
||||
}
|
||||
|
||||
# ifdef _M_X64
|
||||
# pragma intrinsic(_BitScanForward64)
|
||||
# endif
|
||||
# ifdef _M_X64
|
||||
# pragma intrinsic(_BitScanForward64)
|
||||
# endif
|
||||
|
||||
static __forceinline int ffsll(unsigned __int64 x) {
|
||||
static __forceinline int
|
||||
ffsll(unsigned __int64 x) {
|
||||
unsigned long i;
|
||||
#ifdef _M_X64
|
||||
# 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
|
||||
# else
|
||||
// Fallback for 32-bit build where 64-bit version not available
|
||||
// assuming little endian
|
||||
union {
|
||||
unsigned __int64 ll;
|
||||
unsigned long l[2];
|
||||
unsigned long l[2];
|
||||
} s;
|
||||
|
||||
s.ll = x;
|
||||
|
||||
if (_BitScanForward(&i, s.l[0])) {
|
||||
return i + 1;
|
||||
} else if(_BitScanForward(&i, s.l[1])) {
|
||||
} else if (_BitScanForward(&i, s.l[1])) {
|
||||
return i + 33;
|
||||
}
|
||||
return 0;
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
|
||||
#else
|
||||
# define ffsll(x) __builtin_ffsll(x)
|
||||
# define ffsl(x) __builtin_ffsl(x)
|
||||
# define ffs(x) __builtin_ffs(x)
|
||||
# define ffsll(x) __builtin_ffsll(x)
|
||||
# define ffsl(x) __builtin_ffsl(x)
|
||||
# define ffs(x) __builtin_ffs(x)
|
||||
#endif
|
||||
|
||||
#endif /* strings_h */
|
||||
|
||||
Reference in New Issue
Block a user