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