Subject Re: [firebird-support] How to invert a bitmask?
Author Paul Vinkenoog
Michael Ludwig wrote:

> How can I invert a bitmask in Firebird/PSQL (such as with ~ in Perl)?

XOR with a number where all the bits are 1. For signed numbers in two's
complement format, this is always -1. For unsigned numbers, this is
2^n - 1 (with n the number of bits).

So, Firebird's INTEGER and BIGINT being signed, BIN_XOR(number, -1)
should do the trick. Do test it, though!


HTH,
Paul Vinkenoog