MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame^] | 1 | SYNOPSIS |
| 2 | string and_bits(string str1, string str2); |
| 3 | |
| 4 | BESCHREIBUNG |
| 5 | <str1> und <str2> seien beides Bitstrings. Das Resultat von and_bits() |
| 6 | ist ein Bitstring mit dem binaeren Und von <str1> und <str2>, das |
| 7 | heisst ein String, in dem ein Bit nur gesetzt ist, wenn das |
| 8 | entsprechende Bit in beiden Strings <str1> und <str2> gesetzt ist. |
| 9 | |
| 10 | BEISPIEL |
| 11 | string s1, s2, s3; |
| 12 | |
| 13 | s1 = set_bit("", 3); s1 = set_bit(s1, 15); -> s1 is "( (" |
| 14 | s2 = set_bit("", 3); s2 = set_bit(s2, 4); -> s2 is "8" |
| 15 | |
| 16 | s3 = and_bits(s1, s2); |
| 17 | |
| 18 | --> s3 ist jetzt "8", d.h. ein Bitstring, in dem nur das 3. Bit |
| 19 | gesetzt ist. |
| 20 | |
| 21 | SIEHE AUCH |
| 22 | clear_bit(E), set_bit(E), test_bit(E), next_bit(E), last_bit(E), |
| 23 | count_bits(E), or_bits(E), xor_bits(E), invert_bits(E), copy_bits(E) |