SQLite VDBE opcode

BitNot

Interpret the content of register P1 as an integer.

An example

1 of the 178 statements we compiled against the sample database use BitNot. This is the one with the shortest program; the rows that use BitNot are highlighted.

SELECT id & 1, id | 2, id << 3, id >> 1, ~id FROM tracks
addropcodep1p2p3p4p5
0Init01600
1OpenRead1190k(2,,)0
2Rewind115100
3IdxRowid1600
4BitAnd7610
5IdxRowid1600
6BitOr8620
7IdxRowid1600
8ShiftLeft9630
9IdxRowid1600
10ShiftRight7640
11IdxRowid1600
12BitNot6500
13ResultRow1500
14Next1301
15Halt0000
16Transaction00101
17Integer1700
18Integer2800
19Integer3900
20Goto0100

Open it in the EXPLAIN visualizer →

Also in this program: BitAnd, BitOr, Goto, Halt, IdxRowid, Init, Integer, Next, OpenRead, ResultRow, Rewind, ShiftLeft, ShiftRight, Transaction.

What the SQLite documentation says

Interpret the content of register P1 as an integer. Store the ones-complement of the P1 value into register P2. If P1 holds a NULL then store a NULL in P2.

From sqlite.org's list of opcodes for SQLite 3.54.1, in the public domain. Opcodes are not a stable interface and change between releases.

← BitAnd · BitOr →