From: Denis Ovsienko Date: Thu, 1 Feb 2024 13:06:50 +0000 (+0000) Subject: Restore two lowest_set_bit() optimizations. X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/20714edfaeabfb9261ff319b920c48a876f1b30f Restore two lowest_set_bit() optimizations. Commit 4aa89c4 removed two variants optimized not just for DOS, but also for most modern Unix-like OSes and specifically for HP-UX, restore the part that is not specific to DOS. --- diff --git a/optimize.c b/optimize.c index f045e7ad..8b0f5df3 100644 --- a/optimize.c +++ b/optimize.c @@ -141,6 +141,21 @@ lowest_set_bit(int mask) abort(); /* mask is zero */ return (u_int)bit; } +#elif defined(STRINGS_H_DECLARES_FFS) + /* + * A non-Windows OS that has and declares ffs() there (typically + * UN*X conforming to a sufficiently recent version of the Single UNIX + * Specification, but also Haiku). + */ + #include + #define lowest_set_bit(mask) ((u_int)(ffs((mask)) - 1)) +#elif defined(__hpux) + /* + * HP-UX 11i v3, which declares ffs() in , which we've already + * included. Place this branch after the branch, in case a later + * release of HP-UX makes the declaration available via the standard header. + */ + #define lowest_set_bit(mask) ((u_int)(ffs((mask)) - 1)) #else /* * None of the above.