blob: 0ee84267c69d8240bccb972cda40d8e915b9e63f [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
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-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 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;
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
Zesstra715ec202025-07-09 22:18:31 +020018 -> s3 is now "8", ie. a bitstring with bit 3 set only.
MG Mud User88f12472016-06-24 23:31:02 +020019
Zesstra715ec202025-07-09 22:18:31 +020020SEE ALSO
MG Mud User88f12472016-06-24 23:31:02 +020021 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)