If you have PHP, it is still easier. Here bit operations work with strings and you can operate with masks of any length (the main thing is that there is enough RAM). It will turn out somewhat more difficult with masks, but quite clearly.
Defining masks:
define('R0', "\x01"); define('R1', "\x02"); define('R2', "\x04"); define('R3', "\x08"); // ... define('R7', "\x80"); // ... define('R22', "\x00\x00\x40"); define('R23', "\x00\x00\x80"); // ... define('R78', "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40"); define('R79', "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80"); define('R80', "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80"); // ...
Combination of masks:
$flags = R1 | R23 | R78;
Check mask (a bit of distortion 18+):
if (($flags & R23) === R78) { // будет выполнено } if (($flags & R79) === R79) { // НЕ будет выполнено }
Note that the “high byte” is at the end of the line.