MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame^] | 1 | SYNOPSIS |
| 2 | string or_bits(string str1, string str2); |
| 3 | |
| 4 | BESCHREIBUNG |
| 5 | <str1> und <str2> sind beides Bitstrings. Das Resultat von or_bits() |
| 6 | ist ein Bitstring, der das binaere Oder von <str1> und <str2> |
| 7 | enthaelt, d.h. ein String, in dem ein Bit gesetzt ist, wenn es |
| 8 | in <str1> oder <str2> oder in beiden gesetzt ist. |
| 9 | |
| 10 | Jedes Zeichen enthaelt 6 Bits. In jedem Zeichen kann deshalb eine |
| 11 | Zahl von 0 bis 63 gespeichert werde (2^6=64). Das erste Zeichen |
| 12 | ist der Leerschlag " " mit dem Wert 0. Das erste Zeichen im String |
| 13 | ist jenes mit den niedrigsten Bits (0-5). |
| 14 | |
| 15 | BEISPIEL |
| 16 | string s1, s2, s3; |
| 17 | |
| 18 | s1 = set_bit("", 3); s1 = set_bit(s1, 15); -> s1 is "( (" |
| 19 | s2 = set_bit("", 3); s2 = set_bit(s2, 4); -> s2 is "8" |
| 20 | |
| 21 | s3 = or_bits(s1, s2); |
| 22 | |
| 23 | -> s3 is now "8 (", ie. a bitstring with bits 3, 4 and 15 set. |
| 24 | |
| 25 | SIEHE AUCH |
| 26 | clear_bit(E), set_bit(E), test_bit(E), next_bit(E), last_bit(E), |
| 27 | count_bits(E), and_bits(E), xor_bits(E), invert_bits(E), copy_bits(E) |