blob: 66d9fb30e23bad7f9a418d585ff0a32fc3a129e8 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
Zesstrad59c3892019-11-28 20:53:39 +01002 string xor_bits(string str1, string str2)
MG Mud User88f12472016-06-24 23:31:02 +02003
Zesstra715ec202025-07-09 22:18:31 +02004DESCRIPTION
5 <str1> and <str2> are both bitstrings. The result of the function
6 is a bitstring with the binary-xor of <str1> and <str2>,
7 ie. a string in which a bit is set only if the corresponding
8 bits in either <str1> or <str2> (but not both) is set.
MG Mud User88f12472016-06-24 23:31:02 +02009
Zesstra715ec202025-07-09 22:18:31 +020010EXAMPLES
MG Mud User88f12472016-06-24 23:31:02 +020011 string s1, s2, s3;
MG Mud User88f12472016-06-24 23:31:02 +020012
Zesstra715ec202025-07-09 22:18:31 +020013 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 = xor_bits(s1, s2);
17
18 -> s3 is now "0 (", ie. a bitstring with bits 4 and 15 set.
19
20SEE ALSO
21 clear_bit(E), set_bit(E), test_bit(E), next_bit(E), last_bit(E),
MG Mud User88f12472016-06-24 23:31:02 +020022 count_bits(E), and_bits(E), or_bits(E), invert_bits(E), copy_bits(E)