1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Alternative implementation of the comparison opcode speed-up of

check-in [4a8805d9a66dc888] that should pass muster with UBSAN.

FossilOrigin-Name: afb18f64541effaeaada2d72c7c91adfe5ec3e2b1418c0bc281083125fb5badb
This commit is contained in:
drh
2021-03-28 23:37:56 +00:00
parent 9cffb0ffb9
commit 1af3fd562f
5 changed files with 45 additions and 17 deletions

View File

@@ -2111,15 +2111,12 @@ compare_op:
** order: NE, EQ, GT, LE, LT, GE */
assert( OP_Eq==OP_Ne+1 ); assert( OP_Gt==OP_Ne+2 ); assert( OP_Le==OP_Ne+3 );
assert( OP_Lt==OP_Ne+4 ); assert( OP_Ge==OP_Ne+5 );
if( res<0 ){ /* ne, eq, gt, le, lt, ge */
static const unsigned char aLTb[] = { 1, 0, 0, 1, 1, 0 };
res2 = aLTb[pOp->opcode - OP_Ne];
if( res<0 ){
res2 = sqlite3aLTb[pOp->opcode];
}else if( res==0 ){
static const unsigned char aEQb[] = { 0, 1, 0, 1, 0, 1 };
res2 = aEQb[pOp->opcode - OP_Ne];
res2 = sqlite3aEQb[pOp->opcode];
}else{
static const unsigned char aGTb[] = { 1, 0, 1, 0, 0, 1 };
res2 = aGTb[pOp->opcode - OP_Ne];
res2 = sqlite3aGTb[pOp->opcode];
}
/* Undo any changes made by applyAffinity() to the input registers. */