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 and_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-and of <str1> and <str2>, |
| 7 | ie. a string in which a bit is set only if both corresponding |
| 8 | bits in the input strings are set, too. |
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; |
| 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 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 18 | -> s3 is now "8", ie. a bitstring with bit 3 set only. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 19 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 20 | SEE ALSO |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 21 | clear_bit(E), set_bit(E), test_bit(E), next_bit(E), last_bit(E), |
| 22 | count_bits(E), or_bits(E), xor_bits(E), invert_bits(E), copy_bits(E) |