From: Willy Tarreau Date: Sat, 2 Feb 2019 16:05:03 +0000 (+0100) Subject: CLEANUP: threads: use nbits to calculate the thread mask X-Git-Tag: v2.0-dev1~72 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc647360e0ec520cf824c53fb023fff6fb4846ef;p=thirdparty%2Fhaproxy.git CLEANUP: threads: use nbits to calculate the thread mask It's pointless to do arithmetics by hand, we have a function for this. --- diff --git a/src/hathreads.c b/src/hathreads.c index a21bddd9ea..8a4085ee66 100644 --- a/src/hathreads.c +++ b/src/hathreads.c @@ -157,9 +157,7 @@ int parse_nbthread(const char *arg, char **err) return 0; } - /* we proceed like this to be sure never to overflow the left shift */ - all_threads_mask = 1UL << (nbthread - 1); - all_threads_mask |= all_threads_mask - 1; + all_threads_mask = nbits(nbthread); #endif return nbthread; }