blob: de01e96ac1bf3015ceb67d7624d411e75ee63694 [file] [log] [blame]
Zesstra953f9972017-02-18 15:37:36 +01001
2broken_count_bits()
3*******************
4
5
6SYNOPSIS
7========
8
9 int count_bits (string str)
10
11
12DESTRIPTION
13===========
14
15 Count the number of set bits in bitstring <str> and return the number
16 as result.
17
18
19NOTE
20====
21
22 Bitstrings store 6 Bits per Character. Consequently, the functions for
23 manipulating bitstrings (see below) do generally not work on most
24 strings. An exception is this (s)efun. It accepts strings which are
25 not correct bitstrings (like getuid(PL)), BUT: It does NOT work
26 correctly on them! The results are NOT the correct number of bits!
27 Additionally, count_bits() in LDMud rejects such strings with an error
28 instead of returning false results, as all the other functions for
29 bitstrings do as well.
30
31
32EXAMPLES
33========
34
35 string s;
36
37 s = set_bit("", 3); s = set_bit(s, 15);
38
39 count_bits(s) --> returns 2
40
41
42SEE ALSO
43========
44
45 clear_bit(E), set_bit(E), test_bit(E), next_bit(E), last_bit(E),
46 or_bits(E), xor_bits(E), invert_bits(E), copy_bits(E)
47
4819.12.2006, Zesstra