mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-24 01:27:19 +03:00
Add support for MSVC
Tested with MSVC 8 32 and 64 bits.
This commit is contained in:
parent
b45c57ecaf
commit
fd97b1dfc7
11 changed files with 177 additions and 15 deletions
23
include/msvc_compat/strings.h
Normal file
23
include/msvc_compat/strings.h
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#ifndef strings_h
|
||||
#define strings_h
|
||||
|
||||
/* MSVC doesn't define ffs/ffsl. This dummy strings.h header is provided
|
||||
* for both */
|
||||
#include <intrin.h>
|
||||
#pragma intrinsic(_BitScanForward)
|
||||
static __forceinline int ffsl(long x)
|
||||
{
|
||||
unsigned long i;
|
||||
|
||||
if (_BitScanForward(&i, x))
|
||||
return (i + 1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static __forceinline int ffs(int x)
|
||||
{
|
||||
|
||||
return (ffsl(x));
|
||||
}
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue