MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 1 | SYNOPSIS |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 2 | string xor_bits(string str1, string str2) |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 3 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 4 | DESCRIPTION |
| 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 User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 9 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 10 | EXAMPLES |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 11 | string s1, s2, s3; |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 12 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 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 = xor_bits(s1, s2); |
| 17 | |
| 18 | -> s3 is now "0 (", ie. a bitstring with bits 4 and 15 set. |
| 19 | |
| 20 | SEE ALSO |
| 21 | clear_bit(E), set_bit(E), test_bit(E), next_bit(E), last_bit(E), |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 22 | count_bits(E), and_bits(E), or_bits(E), invert_bits(E), copy_bits(E) |