Zesstra | 1862697 | 2017-01-31 10:38:27 +0100 | [diff] [blame] | 1 | broken_count_bits() |
| 2 | =================== |
| 3 | |
| 4 | SYNOPSIS |
| 5 | -------- |
| 6 | :: |
| 7 | |
| 8 | int count_bits (string str) |
| 9 | |
| 10 | DESTRIPTION |
| 11 | ----------- |
| 12 | :: |
| 13 | |
| 14 | Count the number of set bits in bitstring <str> and return the number |
| 15 | as result. |
| 16 | |
| 17 | NOTE |
| 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 | |
| 30 | EXAMPLES |
| 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 | |
| 40 | SEE 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 | |
| 47 | 19.12.2006, Zesstra |
| 48 | |