Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Faster version of sqlite3VdbeSerialGet. (CVS 1495) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
80985505fe8ba8e505842dae95d37bf4 |
User & Date: | drh 2004-05-30 01:51:52.000 |
Context
2004-05-30
| ||
02:14 | Additional minor speed improvements. (CVS 1496) (check-in: a90264c0a4 user: drh tags: trunk) | |
01:51 | Faster version of sqlite3VdbeSerialGet. (CVS 1495) (check-in: 80985505fe user: drh tags: trunk) | |
01:38 | 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) (check-in: fcd84ebabc user: drh tags: trunk) | |
Changes
Changes to src/vdbeaux.c.
︙ | ︙ | |||
1168 1169 1170 1171 1172 1173 1174 | assert( serial_type!=0 ); if( serial_type>6 ){ return (serial_type-12)/2; }else{ static u8 aSize[] = { 0, 1, 2, 4, 8, 8, 0, }; return aSize[serial_type]; } | < < < < < < < < < < < < | 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 | assert( serial_type!=0 ); if( serial_type>6 ){ return (serial_type-12)/2; }else{ static u8 aSize[] = { 0, 1, 2, 4, 8, 8, 0, }; return aSize[serial_type]; } } /* ** Write the serialized data blob for the value stored in pMem into ** buf. It is assumed that the caller has allocated sufficient space. ** Return the number of bytes written. */ |
︙ | ︙ | |||
1233 1234 1235 1236 1237 1238 1239 1240 | int sqlite3VdbeSerialGet( const unsigned char *buf, /* Buffer to deserialize from */ u32 serial_type, /* Serial type to deserialize */ Mem *pMem /* Memory cell to write value into */ ){ int len; assert( serial_type!=0 ); | > < < < < < < | < < < < < | < < < < | | < < | | | | | | > > > > > > > | 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 | int sqlite3VdbeSerialGet( const unsigned char *buf, /* Buffer to deserialize from */ u32 serial_type, /* Serial type to deserialize */ Mem *pMem /* Memory cell to write value into */ ){ int len; len = sqlite3VdbeSerialTypeLen(serial_type); assert( serial_type!=0 ); if( serial_type<=5 ){ /* Integer and Real */ u64 v = 0; int n; if( buf[0]&0x80 ){ v = -1; } for(n=0; n<len; n++){ v = (v<<8) | buf[n]; } if( serial_type==5 ){ pMem->flags = MEM_Real; pMem->r = *(double*)&v; pMem->type = SQLITE3_FLOAT; }else{ pMem->flags = MEM_Int; pMem->i = *(i64*)&v; pMem->type = SQLITE3_INTEGER; } }else if( serial_type>=12 ){ /* String or blob */ pMem->z = (char *)buf; pMem->n = len; if( serial_type&0x01 ){ pMem->flags = MEM_Str | MEM_Ephem; }else{ pMem->flags = MEM_Blob | MEM_Ephem; } }else{ /* NULL */ assert( serial_type==6 ); assert( len==0 ); pMem->flags = MEM_Null; pMem->type = SQLITE3_NULL; } return len; } /* ** The following is the comparison function for (non-integer) ** keys in the btrees. This function returns negative, zero, or |
︙ | ︙ |