X-Git-Url: https://git.tcpdump.org/libpcap/blobdiff_plain/d6a15166ef0d55f113d53f49462abe100cba893b..c82a08e93128e63ae1ca843fd6fd08e76e7eda40:/optimize.c diff --git a/optimize.c b/optimize.c index dba8edfd..a284d413 100644 --- a/optimize.c +++ b/optimize.c @@ -63,8 +63,26 @@ extern int _w32_ffs (int mask); #define ffs _w32_ffs #endif +/* + * So is the check for _MSC_VER done because MinGW has this? + */ #if defined(_WIN32) && defined (_MSC_VER) -int ffs(int mask); +/* + * ffs -- vax ffs instruction + * + * XXX - with versions of VS that have it, use _BitScanForward()? + */ +static int +ffs(int mask) +{ + int bit; + + if (mask == 0) + return(0); + for (bit = 1; !(mask & 1); bit++) + mask >>= 1; + return(bit); +} #endif /*