#endif
-void _debug_break(void)
+#ifndef debug_break
+void debug_break(void)
{
-#if defined(PIPE_ARCH_X86) && defined(PIPE_CC_GCC)
- __asm("int3");
-#elif defined(PIPE_ARCH_X86) && defined(PIPE_CC_MSVC)
- _asm {int 3};
+#if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
+ DebugBreak();
#elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
EngDebugBreak();
#else
abort();
#endif
}
+#endif
#ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY
#endif
-void _debug_break(void);
-
-
/**
* Hard-coded breakpoint.
*/
#ifdef DEBUG
#if defined(PIPE_ARCH_X86) && defined(PIPE_CC_GCC)
#define debug_break() __asm("int3")
-#elif defined(PIPE_ARCH_X86) && defined(PIPE_CC_MSVC)
-#define debug_break() do { _asm {int 3} } while(0)
+#elif defined(PIPE_CC_MSVC)
+#define debug_break() __debugbreak()
#else
-#define debug_break() _debug_break()
+void debug_break(void);
#endif
#else /* !DEBUG */
#define debug_break() ((void)0)
#if defined(PIPE_CC_GCC)
frame_pointer = ((const void **)__builtin_frame_address(1));
-#elif defined(PIPE_CC_MSVC)
+#elif defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)
__asm {
mov frame_pointer, ebp
}
-#if defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)
/**
* Find first bit set in word. Least significant bit is 1.
* Return 0 if no bits set.
*/
+#if defined(_MSC_VER) && _MSC_VER >= 1300
+static INLINE
+unsigned long ffs( unsigned long u )
+{
+ unsigned long i;
+ if(_BitScanForward(&i, u))
+ return i + 1;
+ else
+ return 0;
+}
+#elif defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)
static INLINE
unsigned ffs( unsigned u )
{
return i;
}
-#endif
-
-#ifdef __MINGW32__
+#elif defined(__MINGW32__)
#define ffs __builtin_ffs
#endif