blob: cf69e0261998515bd99996fc14872eb5a92f4509 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
Zesstrad59c3892019-11-28 20:53:39 +01002 string invert_bits(string str)
MG Mud User88f12472016-06-24 23:31:02 +02003
Zesstra715ec202025-07-09 22:18:31 +02004DESCRIPTION
5 Invert the status of all bits in bitstring <str> and return the
6 new string.
MG Mud User88f12472016-06-24 23:31:02 +02007
Zesstra715ec202025-07-09 22:18:31 +02008 Note that the total number of bits (ie the string length) stays
9 the same.
10
11EXAMPLES
MG Mud User88f12472016-06-24 23:31:02 +020012 string s;
MG Mud User88f12472016-06-24 23:31:02 +020013
Zesstra715ec202025-07-09 22:18:31 +020014 s = set_bit("", 3); s = set_bit(s, 4); s = set_bit(s, 15);
15 --> s is now "8 ("
16
17 invert_bits(s) --> returns "G_W"
18
19SEE ALSO
MG Mud User88f12472016-06-24 23:31:02 +020020 set_bit(E), clear_bit(E), test_bit(E), last_bit(E), and_bits(E),
21 or_bits(E), xor_bits(E), count_bits(E), copy_bits(E)