]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: threads: use nbits to calculate the thread mask
authorWilly Tarreau <w@1wt.eu>
Sat, 2 Feb 2019 16:05:03 +0000 (17:05 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 2 Feb 2019 16:48:39 +0000 (17:48 +0100)
It's pointless to do arithmetics by hand, we have a function for this.

src/hathreads.c

index a21bddd9eafc4369efb3e21a6e01d91e46109ce1..8a4085ee66e538d577b3e10e1db9adb5fa41228e 100644 (file)
@@ -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;
 }