mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-09 14:21:03 +03:00
Add versions of OP_MakeRecord and OP_Column that use manifest typing (not
activated yet). (CVS 1334) FossilOrigin-Name: 8a66a502ba09e3d858d2f45df9b3b665ebb85d5b
This commit is contained in:
29
src/util.c
29
src/util.c
@@ -14,7 +14,7 @@
|
||||
** This file contains functions for allocating memory, comparing
|
||||
** strings, and stuff like that.
|
||||
**
|
||||
** $Id: util.c,v 1.76 2004/05/08 08:23:40 danielk1977 Exp $
|
||||
** $Id: util.c,v 1.77 2004/05/10 07:17:32 danielk1977 Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <stdarg.h>
|
||||
@@ -1134,5 +1134,32 @@ int sqlite3SafetyCheck(sqlite *db){
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sqlite3PutVarint(unsigned char *p, u64 v){
|
||||
int i = 0;
|
||||
do{
|
||||
p[i++] = (v & 0x7f) | 0x80;
|
||||
v >>= 7;
|
||||
}while( v!=0 );
|
||||
p[i-1] &= 0x7f;
|
||||
return i;
|
||||
}
|
||||
|
||||
int sqlite3GetVarint(unsigned char *p, u64 *v){
|
||||
u64 x = p[0] & 0x7f;
|
||||
int n = 0;
|
||||
while( (p[n++]&0x80)!=0 ){
|
||||
x |= (p[n]&0x7f)<<(n*7);
|
||||
}
|
||||
*v = x;
|
||||
return n;
|
||||
}
|
||||
|
||||
int sqlite3VarintLen(u64 v){
|
||||
int i = 0;
|
||||
do{
|
||||
i++;
|
||||
v >>= 7;
|
||||
}while( v!=0 );
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user