diff --git a/configure b/configure index c8648d4b2552b0343db48667c63f3dce65333539..d553b1a026e4d057958896f06ef54e190ae558e4 100755 --- a/configure +++ b/configure @@ -16146,6 +16146,7 @@ fi + for ac_func in \ @@ -16161,6 +16162,7 @@ for ac_func in \ chsize \ clone \ epoll_create \ + ffs \ finite \ fork \ fpclass \ diff --git a/configure.ac b/configure.ac index 5e958101d8215f5f28c0875be5bcacb8d919533e..7028730eab993b9c0dd21c7dc469cccdb476b6b7 100644 --- a/configure.ac +++ b/configure.ac @@ -1076,6 +1076,7 @@ AC_CHECK_FUNCS(\ chsize \ clone \ epoll_create \ + ffs \ finite \ fork \ fpclass \ diff --git a/dlls/itss/chm_lib.c b/dlls/itss/chm_lib.c index e6526a8412b46b633c051e62d40220d32e2f6f2a..7020153ac39cfd30076a357ba2bcc489a46b5303 100644 --- a/dlls/itss/chm_lib.c +++ b/dlls/itss/chm_lib.c @@ -46,6 +46,7 @@ ***************************************************************************/ #include "config.h" +#include "wine/port.h" #include <stdarg.h> #include <stdio.h> diff --git a/include/config.h.in b/include/config.h.in index 2ac53c42bb24661b7940ee8a56094f708af82d6c..a1dbecad701b413a973e993aa51dbbd6878e8196 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -83,6 +83,9 @@ /* Define to 1 if you have the `epoll_create' function. */ #undef HAVE_EPOLL_CREATE +/* Define to 1 if you have the `ffs' function. */ +#undef HAVE_FFS + /* Define to 1 if you have the `finite' function. */ #undef HAVE_FINITE diff --git a/include/wine/port.h b/include/wine/port.h index 0cf862889e229e091de0aa2dcb904c625b9a90fe..32f2ec2a0b143057525412e1c0c1326b9dafb39d 100644 --- a/include/wine/port.h +++ b/include/wine/port.h @@ -282,6 +282,10 @@ extern int getopt_long_only (int ___argc, char *const *___argv, const struct option *__longopts, int *__longind); #endif /* HAVE_GETOPT_LONG */ +#ifndef HAVE_FFS +int ffs( int x ); +#endif + #ifndef HAVE_FUTIMES struct timeval; int futimes(int fd, const struct timeval tv[2]); @@ -431,6 +435,7 @@ extern long interlocked_xchg_add( long *dest, long incr ); #define __WINE_NOT_PORTABLE(func) func##_is_not_portable func##_is_not_portable +#define ffs __WINE_NOT_PORTABLE(ffs) #define fstatvfs __WINE_NOT_PORTABLE(fstatvfs) #define futimes __WINE_NOT_PORTABLE(futimes) #define getopt_long __WINE_NOT_PORTABLE(getopt_long) diff --git a/libs/port/Makefile.in b/libs/port/Makefile.in index 388da0789229f83a36b2715b05c2a2a0ba0fca1e..b61e7c73b4a81d132f5657c95f90fee2e8b8130b 100644 --- a/libs/port/Makefile.in +++ b/libs/port/Makefile.in @@ -7,6 +7,7 @@ VPATH = @srcdir@ MODULE = libwine_port.a C_SRCS = \ + ffs.c \ fstatvfs.c \ futimes.c \ getopt.c \ diff --git a/libs/port/ffs.c b/libs/port/ffs.c new file mode 100644 index 0000000000000000000000000000000000000000..556e68c2ee0677f5c75d71cd72607e49c9f39d52 --- /dev/null +++ b/libs/port/ffs.c @@ -0,0 +1,64 @@ +/* + * ffs function + * + * Copyright 2004 Hans Leidekker + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" +#include "wine/port.h" + +#ifndef HAVE_FFS +int ffs( int x ) +{ + unsigned int y = (unsigned int)x; + + if (y & 0x00000001) return 1; + if (y & 0x00000002) return 2; + if (y & 0x00000004) return 3; + if (y & 0x00000008) return 4; + if (y & 0x00000010) return 5; + if (y & 0x00000020) return 6; + if (y & 0x00000040) return 7; + if (y & 0x00000080) return 8; + if (y & 0x00000100) return 9; + if (y & 0x00000200) return 10; + if (y & 0x00000400) return 11; + if (y & 0x00000800) return 12; + if (y & 0x00001000) return 13; + if (y & 0x00002000) return 14; + if (y & 0x00004000) return 15; + if (y & 0x00008000) return 16; + if (y & 0x00010000) return 17; + if (y & 0x00020000) return 18; + if (y & 0x00040000) return 19; + if (y & 0x00080000) return 20; + if (y & 0x00100000) return 21; + if (y & 0x00200000) return 22; + if (y & 0x00400000) return 23; + if (y & 0x00800000) return 24; + if (y & 0x01000000) return 25; + if (y & 0x02000000) return 26; + if (y & 0x04000000) return 27; + if (y & 0x08000000) return 28; + if (y & 0x10000000) return 29; + if (y & 0x20000000) return 30; + if (y & 0x40000000) return 31; + if (y & 0x80000000) return 32; + + return 0; +} +#endif /* HAVE_FFS */