mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-09 14:21:03 +03:00
Factor out constant expressions in sqlite3GetVarint() to work around
nuisance warning messages from the RVT compiler. FossilOrigin-Name: 83e47ca0069de259e98798d84d88301a5b4b6d2e
This commit is contained in:
24
manifest
24
manifest
@@ -1,5 +1,8 @@
|
|||||||
C Modify\sthe\scommand\sline\stool\sto\sdisable\sall\smutexes.\sThe\scommand\sline\stool\sis\ssingle-threaded.
|
-----BEGIN PGP SIGNED MESSAGE-----
|
||||||
D 2010-03-03T07:23:13
|
Hash: SHA1
|
||||||
|
|
||||||
|
C Factor\sout\sconstant\sexpressions\sin\ssqlite3GetVarint()\sto\swork\saround\nnuisance\swarning\smessages\sfrom\sthe\sRVT\scompiler.
|
||||||
|
D 2010-03-03T15:18:38
|
||||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||||
F Makefile.in 4f2f967b7e58a35bb74fb7ec8ae90e0f4ca7868b
|
F Makefile.in 4f2f967b7e58a35bb74fb7ec8ae90e0f4ca7868b
|
||||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||||
@@ -209,7 +212,7 @@ F src/tokenize.c 25ceb0f0a746ea1d0f9553787f3f0a56853cfaeb
|
|||||||
F src/trigger.c 340c9eca0fb24b1197468d96ba059f867c9834c7
|
F src/trigger.c 340c9eca0fb24b1197468d96ba059f867c9834c7
|
||||||
F src/update.c c0dc6b75ad28b76b619042d934f337b02acee208
|
F src/update.c c0dc6b75ad28b76b619042d934f337b02acee208
|
||||||
F src/utf.c dad16adcc0c35ef2437dca125a4b07419d361052
|
F src/utf.c dad16adcc0c35ef2437dca125a4b07419d361052
|
||||||
F src/util.c 0a28d634d41031be63da19cc7cdfbc4a7e0bfea6
|
F src/util.c 23c2e2a05ae1a2a8b848e6b145cc506d8f9ff223
|
||||||
F src/vacuum.c b1d542c8919d4d11119f78069e1906a1ad07e0ee
|
F src/vacuum.c b1d542c8919d4d11119f78069e1906a1ad07e0ee
|
||||||
F src/vdbe.c 8b705e48cf4b6d0493ad0f109763d60c1b429487
|
F src/vdbe.c 8b705e48cf4b6d0493ad0f109763d60c1b429487
|
||||||
F src/vdbe.h 471f6a3dcec4817ca33596fe7f6654d56c0e75f3
|
F src/vdbe.h 471f6a3dcec4817ca33596fe7f6654d56c0e75f3
|
||||||
@@ -792,7 +795,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
|||||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||||
P 9daf4e7d07769f25b3a579d80e7fada4e52344b1
|
P 00e5679047a0a96dc4396aae5e061909faf3b81d
|
||||||
R 859cf9b209862d32a71f4ee0365fe351
|
R d5279b0f0440c162ac13b57ad638ff10
|
||||||
U dan
|
U drh
|
||||||
Z fafbabd08193cd28bca0509d29b6e94b
|
Z 7a56c2200dee81fc4fcb29db9cc92e1e
|
||||||
|
-----BEGIN PGP SIGNATURE-----
|
||||||
|
Version: GnuPG v1.4.6 (GNU/Linux)
|
||||||
|
|
||||||
|
iD8DBQFLjn3XoxKgR168RlERAk+wAKCIrMiXPhEryGElvlKVi8+iIR5PHACfQJjd
|
||||||
|
3YnU+1KeqqESzTSJszdAYpA=
|
||||||
|
=A+ES
|
||||||
|
-----END PGP SIGNATURE-----
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
00e5679047a0a96dc4396aae5e061909faf3b81d
|
83e47ca0069de259e98798d84d88301a5b4b6d2e
|
||||||
37
src/util.c
37
src/util.c
@@ -650,6 +650,19 @@ int sqlite3PutVarint32(unsigned char *p, u32 v){
|
|||||||
return sqlite3PutVarint(p, v);
|
return sqlite3PutVarint(p, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Bitmasks used by sqlite3GetVarint(). These precomputed constants
|
||||||
|
** are defined here rather than simply putting the constant expressions
|
||||||
|
** inline in order to work around bugs in the RVT compiler.
|
||||||
|
**
|
||||||
|
** SLOT_2_0 A mask for (0x7f<<14) | 0x7f
|
||||||
|
**
|
||||||
|
** SLOT_4_2_0 A mask for (0x7f<<28) | SLOT_2_0
|
||||||
|
*/
|
||||||
|
#define SLOT_2_0 0x001fc07f
|
||||||
|
#define SLOT_4_2_0 0xf01fc07f
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Read a 64-bit variable-length integer from memory starting at p[0].
|
** Read a 64-bit variable-length integer from memory starting at p[0].
|
||||||
** Return the number of bytes read. The value is stored in *v.
|
** Return the number of bytes read. The value is stored in *v.
|
||||||
@@ -677,13 +690,17 @@ u8 sqlite3GetVarint(const unsigned char *p, u64 *v){
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Verify that constants are precomputed correctly */
|
||||||
|
assert( SLOT_2_0 == ((0x7f<<14) | (0x7f)) );
|
||||||
|
assert( SLOT_4_2_0 == ((0xf<<28) | (0x7f<<14) | (0x7f)) );
|
||||||
|
|
||||||
p++;
|
p++;
|
||||||
a = a<<14;
|
a = a<<14;
|
||||||
a |= *p;
|
a |= *p;
|
||||||
/* a: p0<<14 | p2 (unmasked) */
|
/* a: p0<<14 | p2 (unmasked) */
|
||||||
if (!(a&0x80))
|
if (!(a&0x80))
|
||||||
{
|
{
|
||||||
a &= (0x7f<<14)|(0x7f);
|
a &= SLOT_2_0;
|
||||||
b &= 0x7f;
|
b &= 0x7f;
|
||||||
b = b<<7;
|
b = b<<7;
|
||||||
a |= b;
|
a |= b;
|
||||||
@@ -692,14 +709,14 @@ u8 sqlite3GetVarint(const unsigned char *p, u64 *v){
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* CSE1 from below */
|
/* CSE1 from below */
|
||||||
a &= (0x7f<<14)|(0x7f);
|
a &= SLOT_2_0;
|
||||||
p++;
|
p++;
|
||||||
b = b<<14;
|
b = b<<14;
|
||||||
b |= *p;
|
b |= *p;
|
||||||
/* b: p1<<14 | p3 (unmasked) */
|
/* b: p1<<14 | p3 (unmasked) */
|
||||||
if (!(b&0x80))
|
if (!(b&0x80))
|
||||||
{
|
{
|
||||||
b &= (0x7f<<14)|(0x7f);
|
b &= SLOT_2_0;
|
||||||
/* moved CSE1 up */
|
/* moved CSE1 up */
|
||||||
/* a &= (0x7f<<14)|(0x7f); */
|
/* a &= (0x7f<<14)|(0x7f); */
|
||||||
a = a<<7;
|
a = a<<7;
|
||||||
@@ -713,7 +730,7 @@ u8 sqlite3GetVarint(const unsigned char *p, u64 *v){
|
|||||||
/* 1:save off p0<<21 | p1<<14 | p2<<7 | p3 (masked) */
|
/* 1:save off p0<<21 | p1<<14 | p2<<7 | p3 (masked) */
|
||||||
/* moved CSE1 up */
|
/* moved CSE1 up */
|
||||||
/* a &= (0x7f<<14)|(0x7f); */
|
/* a &= (0x7f<<14)|(0x7f); */
|
||||||
b &= (0x7f<<14)|(0x7f);
|
b &= SLOT_2_0;
|
||||||
s = a;
|
s = a;
|
||||||
/* s: p0<<14 | p2 (masked) */
|
/* s: p0<<14 | p2 (masked) */
|
||||||
|
|
||||||
@@ -746,7 +763,7 @@ u8 sqlite3GetVarint(const unsigned char *p, u64 *v){
|
|||||||
{
|
{
|
||||||
/* we can skip this cause it was (effectively) done above in calc'ing s */
|
/* we can skip this cause it was (effectively) done above in calc'ing s */
|
||||||
/* b &= (0x7f<<28)|(0x7f<<14)|(0x7f); */
|
/* b &= (0x7f<<28)|(0x7f<<14)|(0x7f); */
|
||||||
a &= (0x7f<<14)|(0x7f);
|
a &= SLOT_2_0;
|
||||||
a = a<<7;
|
a = a<<7;
|
||||||
a |= b;
|
a |= b;
|
||||||
s = s>>18;
|
s = s>>18;
|
||||||
@@ -760,8 +777,8 @@ u8 sqlite3GetVarint(const unsigned char *p, u64 *v){
|
|||||||
/* a: p2<<28 | p4<<14 | p6 (unmasked) */
|
/* a: p2<<28 | p4<<14 | p6 (unmasked) */
|
||||||
if (!(a&0x80))
|
if (!(a&0x80))
|
||||||
{
|
{
|
||||||
a &= (0x1f<<28)|(0x7f<<14)|(0x7f);
|
a &= SLOT_4_2_0;
|
||||||
b &= (0x7f<<14)|(0x7f);
|
b &= SLOT_2_0;
|
||||||
b = b<<7;
|
b = b<<7;
|
||||||
a |= b;
|
a |= b;
|
||||||
s = s>>11;
|
s = s>>11;
|
||||||
@@ -770,14 +787,14 @@ u8 sqlite3GetVarint(const unsigned char *p, u64 *v){
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* CSE2 from below */
|
/* CSE2 from below */
|
||||||
a &= (0x7f<<14)|(0x7f);
|
a &= SLOT_2_0;
|
||||||
p++;
|
p++;
|
||||||
b = b<<14;
|
b = b<<14;
|
||||||
b |= *p;
|
b |= *p;
|
||||||
/* b: p3<<28 | p5<<14 | p7 (unmasked) */
|
/* b: p3<<28 | p5<<14 | p7 (unmasked) */
|
||||||
if (!(b&0x80))
|
if (!(b&0x80))
|
||||||
{
|
{
|
||||||
b &= (0x1f<<28)|(0x7f<<14)|(0x7f);
|
b &= SLOT_4_2_0;
|
||||||
/* moved CSE2 up */
|
/* moved CSE2 up */
|
||||||
/* a &= (0x7f<<14)|(0x7f); */
|
/* a &= (0x7f<<14)|(0x7f); */
|
||||||
a = a<<7;
|
a = a<<7;
|
||||||
@@ -794,7 +811,7 @@ u8 sqlite3GetVarint(const unsigned char *p, u64 *v){
|
|||||||
|
|
||||||
/* moved CSE2 up */
|
/* moved CSE2 up */
|
||||||
/* a &= (0x7f<<29)|(0x7f<<15)|(0xff); */
|
/* a &= (0x7f<<29)|(0x7f<<15)|(0xff); */
|
||||||
b &= (0x7f<<14)|(0x7f);
|
b &= SLOT_2_0;
|
||||||
b = b<<8;
|
b = b<<8;
|
||||||
a |= b;
|
a |= b;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user