blob: de01e96ac1bf3015ceb67d7624d411e75ee63694 [file] [log] [blame]
Zesstra953f9972017-02-18 15:37:36 +01001
2broken_count_bits()
3*******************
4
5
MG Mud User88f12472016-06-24 23:31:02 +02006SYNOPSIS
Zesstra953f9972017-02-18 15:37:36 +01007========
8
9 int count_bits (string str)
10
MG Mud User88f12472016-06-24 23:31:02 +020011
12DESTRIPTION
Zesstra953f9972017-02-18 15:37:36 +010013===========
14
15 Count the number of set bits in bitstring <str> and return the number
16 as result.
17
MG Mud User88f12472016-06-24 23:31:02 +020018
19NOTE
Zesstra953f9972017-02-18 15:37:36 +010020====
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
MG Mud User88f12472016-06-24 23:31:02 +020031
32EXAMPLES
Zesstra953f9972017-02-18 15:37:36 +010033========
MG Mud User88f12472016-06-24 23:31:02 +020034
Zesstra953f9972017-02-18 15:37:36 +010035 string s;
MG Mud User88f12472016-06-24 23:31:02 +020036
Zesstra953f9972017-02-18 15:37:36 +010037 s = set_bit("", 3); s = set_bit(s, 15);
38
39 count_bits(s) --> returns 2
40
MG Mud User88f12472016-06-24 23:31:02 +020041
42SEE ALSO
Zesstra953f9972017-02-18 15:37:36 +010043========
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)
MG Mud User88f12472016-06-24 23:31:02 +020047
4819.12.2006, Zesstra