]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: tools: implement functions to look up the nth bit set in a mask
authorWilly Tarreau <w@1wt.eu>
Tue, 26 Feb 2019 08:56:22 +0000 (09:56 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 27 Feb 2019 13:27:07 +0000 (14:27 +0100)
commitf3241115e7195925a30e41e363536b24111c0cc8
treedc84df13774225c621f7cd5fc5696d093ce8642b
parent9e85318417773a9ad01b8405415b8086096f20eb
MINOR: tools: implement functions to look up the nth bit set in a mask

Function mask_find_rank_bit() returns the bit position in mask <m> of
the nth bit set of rank <r>, between 0 and LONGBITS-1 included, starting
from the left. For example ranks 0,1,2,3 for mask 0x55 will be 6, 4, 2
and 0 respectively. This algorithm is based on a popcount variant and
is described here : https://graphics.stanford.edu/~seander/bithacks.html.
include/common/standard.h
src/standard.c