[cairo-commit] src/cairo-compiler-private.h
Jeff Muizelaar
jrmuizel at kemper.freedesktop.org
Thu May 6 08:47:03 PDT 2010
src/cairo-compiler-private.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
New commits:
commit f5167dc2e1a13d8c4e5d66d7178a24b9b5e7ac7a
Author: Jeff Muizelaar <jmuizelaar at mozilla.com>
Date: Thu May 6 11:43:52 2010 -0400
Add an implementation of ffs() for MSVC
diff --git a/src/cairo-compiler-private.h b/src/cairo-compiler-private.h
index d257d09..e25ee1f 100644
--- a/src/cairo-compiler-private.h
+++ b/src/cairo-compiler-private.h
@@ -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)
More information about the cairo-commit
mailing list