mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-04-24 16:10:39 +02:00
Add an implementation of ffs() for MSVC
This commit is contained in:
parent
a2a2bd62ff
commit
f5167dc2e1
1 changed files with 15 additions and 0 deletions
|
|
@ -212,6 +212,21 @@
|
|||
#ifdef _MSC_VER
|
||||
#undef inline
|
||||
#define inline __inline
|
||||
|
||||
/* Add a definition of ffs */
|
||||
#include <intrin.h>
|
||||
#pragma intrinsic(_BitScanForward)
|
||||
static __forceinline int
|
||||
ffs (int x)
|
||||
{
|
||||
unsigned long i;
|
||||
|
||||
if (_BitScanForward(&i, x) != 0)
|
||||
return i + 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && defined(_M_IX86)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue