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