From 4972d592113c627d4b6ea1be5c94a85b56099afd Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sat, 12 Jun 2010 16:07:12 +0200 Subject: win32: Add missing function ffs mingw32 does not include function ffs. Commit c6d29ad6e24533cc3762e1d654275607e1d03058 added a declaration for ffs, but an implementation was missing. For compilations with optimization, the compiler creates inline code, so the implementation is not always needed. Without optimization, linking fails without this patch. v2: Use __builtin_ffs as suggested by Richard Henderson Cc: Richard Henderson Signed-off-by: Stefan Weil Signed-off-by: Blue Swirl --- osdep.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/osdep.c b/osdep.c index abbc8a2381..dbf872aea7 100644 --- a/osdep.c +++ b/osdep.c @@ -167,6 +167,13 @@ int qemu_create_pidfile(const char *filename) #ifdef _WIN32 +/* mingw32 needs ffs for compilations without optimization. */ +int ffs(int i) +{ + /* Use gcc's builtin ffs. */ + return __builtin_ffs(i); +} + /* Offset between 1/1/1601 and 1/1/1970 in 100 nanosec units */ #define _W32_FT_OFFSET (116444736000000000ULL) -- cgit v1.2.1