win32: Add missing function ffs

mingw32 does not include function ffs.

Commit c6d29ad6e2 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>
This commit is contained in:
Stefan Weil 2010-06-12 16:07:12 +02:00 committed by Blue Swirl
parent 5635efc388
commit 4972d59211
1 changed files with 7 additions and 0 deletions

View File

@ -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)