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 invert_bits(string str) |
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 | Invert the status of all bits in bitstring <str> and return the |
| 6 | new string. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 7 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 8 | Note that the total number of bits (ie the string length) stays |
| 9 | the same. |
| 10 | |
| 11 | EXAMPLES |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 12 | string s; |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 13 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 14 | 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 | |
| 19 | SEE ALSO |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 20 | 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) |