R Smith wrote:
> I meant a binary operation, not a Boolean operation NOT.
"NOT X" = "-X - 1"
> Answering (2): A strongly typed language that defines INT/UINT/WORD/
> INT64/etc. as specifically a 32-bit or 64-bit signed/unsigned
> representation, or "Byte" as a 8-bit unsigned representation will be
> sensible to say a = not b; where a and b are both typed as BYTE values.
> but if you don't know how many bits are "meant" to be in "a", how to
> determine how many bits must be negated / "notted" / changed to produce
> the result of "NOT b" in the way described up there.
> If for example a = 0xA then !a might be 0x5 for a nibble, but it will
> be 0xF5 for a byte, 0xFFF5 for a WORD, 0xFFFFFF5 for a 32bit INT, etc.
In SQLite, all integers are signed 64-bit values.
> It's often used in masking bit flag sequences. a = (a & !0x3) would
> see "a" being switched so that it's LSB's 0 and 1 gets switched off
> while leaving the others in tact.
When clearing bits, the additional bits in the mask do not matter:
SELECT printf("%#x", 0xaf & (-0x03-1));
sqlite-users mailing list