blob: f72399b97e15e7690d6b62d597e1bd60d75ae07e [file] [log] [blame]
Zesstra953f9972017-02-18 15:37:36 +01001broken_count_bits()
2*******************
3
4
MG Mud User88f12472016-06-24 23:31:02 +02005SYNOPSIS
Zesstra953f9972017-02-18 15:37:36 +01006========
7
8 int count_bits (string str)
9
MG Mud User88f12472016-06-24 23:31:02 +020010
11DESTRIPTION
Zesstra953f9972017-02-18 15:37:36 +010012===========
13
14 Count the number of set bits in bitstring <str> and return the number
15 as result.
16
MG Mud User88f12472016-06-24 23:31:02 +020017
18NOTE
Zesstra953f9972017-02-18 15:37:36 +010019====
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
MG Mud User88f12472016-06-24 23:31:02 +020030
31EXAMPLES
Zesstra953f9972017-02-18 15:37:36 +010032========
MG Mud User88f12472016-06-24 23:31:02 +020033
Zesstra953f9972017-02-18 15:37:36 +010034 string s;
MG Mud User88f12472016-06-24 23:31:02 +020035
Zesstra953f9972017-02-18 15:37:36 +010036 s = set_bit("", 3); s = set_bit(s, 15);
37
38 count_bits(s) --> returns 2
39
MG Mud User88f12472016-06-24 23:31:02 +020040
41SEE ALSO
Zesstra953f9972017-02-18 15:37:36 +010042========
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)
MG Mud User88f12472016-06-24 23:31:02 +020046
4719.12.2006, Zesstra