summaryrefslogtreecommitdiff
path: root/osdep.c
diff options
context:
space:
mode:
authorStefan Weil <weil@mail.berlios.de>2010-06-12 16:07:12 +0200
committerBlue Swirl <blauwirbel@gmail.com>2010-06-27 19:25:25 +0300
commit4972d592113c627d4b6ea1be5c94a85b56099afd (patch)
tree1ccf666e73b5a5f37e89e60106ad9b32a8b7cad1 /osdep.c
parent5635efc388119e1c1cc03d19e88596c2b1a75bef (diff)
downloadqemu-4972d592113c627d4b6ea1be5c94a85b56099afd.tar.gz
qemu-4972d592113c627d4b6ea1be5c94a85b56099afd.tar.bz2
qemu-4972d592113c627d4b6ea1be5c94a85b56099afd.zip
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 <rth@twiddle.net> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'osdep.c')
-rw-r--r--osdep.c7
1 files changed, 7 insertions, 0 deletions
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)