# if defined(__GNUC__) && defined(HAVE_BUILTIN_CTZL) && ((__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) \
|| defined(__LITTLE_ENDIAN__))
# define std3_longest_match
+# elif(defined(_MSC_VER) && defined(_WIN32))
+# define std3_longest_match
# else
# define std2_longest_match
# endif
#ifdef std3_longest_match
+#ifdef _MSC_VER
+#include <intrin.h>
+/* This is not a general purpose replacement for __builtin_ctzl. The function expects that value is != 0
+ * Because of that assumption trailing_zero is not initialized and the return value of _BitScanForward is not checked
+ */
+static __forceinline unsigned long __builtin_ctzl(unsigned long value)
+{
+ unsigned long trailing_zero;
+ _BitScanForward(&trailing_zero, value);
+ return trailing_zero;
+}
+#endif
+
/* longest_match() with minor change to improve performance (in terms of
* execution time).
*