Do not include the P3 parameter on OP_Integer opcodes if the integer will fit
in 32 bits. The P3 conversion is slow. (CVS 1494)
FossilOrigin-Name: fcd84ebabca72023e76e6954514948aa9a3ab999
diff --git a/src/expr.c b/src/expr.c
index 1e87ed8..12dbd99 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -12,7 +12,7 @@
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
-** $Id: expr.c,v 1.132 2004/05/29 11:24:50 danielk1977 Exp $
+** $Id: expr.c,v 1.133 2004/05/30 01:38:43 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -1068,8 +1068,10 @@
*/
static void codeInteger(Vdbe *v, const char *z, int n){
int i;
- if( sqlite3GetInt32(z, &i) || (i=0, sqlite3FitsIn64Bits(z))!=0 ){
- sqlite3VdbeOp3(v, OP_Integer, i, 0, z, n);
+ if( sqlite3GetInt32(z, &i) ){
+ sqlite3VdbeAddOp(v, OP_Integer, i, 0);
+ }else if( sqlite3FitsIn64Bits(z) ){
+ sqlite3VdbeOp3(v, OP_Integer, 0, 0, z, n);
}else{
sqlite3VdbeOp3(v, OP_Real, 0, 0, z, n);
}
diff --git a/src/vdbemem.c b/src/vdbemem.c
index d3e3860..69e1c39 100644
--- a/src/vdbemem.c
+++ b/src/vdbemem.c
@@ -209,11 +209,12 @@
** prior representations are invalidated. NULL is converted into 0.
*/
int sqlite3VdbeMemIntegerify(Mem *pMem){
- if( pMem->flags & MEM_Int ){
+ int flags = pMem->flags;
+ if( flags & MEM_Int ){
/* Do nothing */
- }else if( pMem->flags & MEM_Real ){
+ }else if( flags & MEM_Real ){
pMem->i = (i64)pMem->r;
- }else if( pMem->flags & (MEM_Str|MEM_Blob) ){
+ }else if( flags & (MEM_Str|MEM_Blob) ){
if( sqlite3VdbeChangeEncoding(pMem, TEXT_Utf8)
|| sqlite3VdbeMemNulTerminate(pMem) ){
return SQLITE_NOMEM;