blob: d1d89a3c8df11e271def07ce362e45eea806d89e [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
Zesstrad59c3892019-11-28 20:53:39 +01002 string and_bits(string str1, string str2)
MG Mud User88f12472016-06-24 23:31:02 +02003
4BESCHREIBUNG
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
Zesstrad59c3892019-11-28 20:53:39 +010010BEISPIELE
MG Mud User88f12472016-06-24 23:31:02 +020011 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
21SIEHE 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)