persistentstorage/sql/SQLite/util.c
branchRCL_3
changeset 45 cc28652e0254
parent 44 26645d81f48d
--- a/persistentstorage/sql/SQLite/util.c	Tue Aug 31 16:57:14 2010 +0300
+++ b/persistentstorage/sql/SQLite/util.c	Wed Sep 01 12:39:58 2010 +0100
@@ -546,19 +546,6 @@
 }
 
 /*
-** 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].
 ** Return the number of bytes read.  The value is stored in *v.
 */
@@ -585,17 +572,13 @@
     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++;
   a = a<<14;
   a |= *p;
   /* a: p0<<14 | p2 (unmasked) */
   if (!(a&0x80))
   {
-    a &= SLOT_2_0;
+    a &= (0x7f<<14)|(0x7f);
     b &= 0x7f;
     b = b<<7;
     a |= b;
@@ -604,14 +587,14 @@
   }
 
   /* CSE1 from below */
-  a &= SLOT_2_0;
+  a &= (0x7f<<14)|(0x7f);
   p++;
   b = b<<14;
   b |= *p;
   /* b: p1<<14 | p3 (unmasked) */
   if (!(b&0x80))
   {
-    b &= SLOT_2_0;
+    b &= (0x7f<<14)|(0x7f);
     /* moved CSE1 up */
     /* a &= (0x7f<<14)|(0x7f); */
     a = a<<7;
@@ -625,7 +608,7 @@
   /* 1:save off p0<<21 | p1<<14 | p2<<7 | p3 (masked) */
   /* moved CSE1 up */
   /* a &= (0x7f<<14)|(0x7f); */
-  b &= SLOT_2_0;
+  b &= (0x7f<<14)|(0x7f);
   s = a;
   /* s: p0<<14 | p2 (masked) */
 
@@ -658,7 +641,7 @@
   {
     /* we can skip this cause it was (effectively) done above in calc'ing s */
     /* b &= (0x7f<<28)|(0x7f<<14)|(0x7f); */
-    a &= SLOT_2_0;
+    a &= (0x7f<<14)|(0x7f);
     a = a<<7;
     a |= b;
     s = s>>18;
@@ -672,8 +655,8 @@
   /* a: p2<<28 | p4<<14 | p6 (unmasked) */
   if (!(a&0x80))
   {
-    a &= SLOT_4_2_0;
-    b &= SLOT_2_0;
+    a &= (0x7f<<28)|(0x7f<<14)|(0x7f);
+    b &= (0x7f<<14)|(0x7f);
     b = b<<7;
     a |= b;
     s = s>>11;
@@ -682,14 +665,14 @@
   }
 
   /* CSE2 from below */
-  a &= SLOT_2_0;
+  a &= (0x7f<<14)|(0x7f);
   p++;
   b = b<<14;
   b |= *p;
   /* b: p3<<28 | p5<<14 | p7 (unmasked) */
   if (!(b&0x80))
   {
-    b &= SLOT_4_2_0;
+    b &= (0x7f<<28)|(0x7f<<14)|(0x7f);
     /* moved CSE2 up */
     /* a &= (0x7f<<14)|(0x7f); */
     a = a<<7;
@@ -706,7 +689,7 @@
 
   /* moved CSE2 up */
   /* a &= (0x7f<<29)|(0x7f<<15)|(0xff); */
-  b &= SLOT_2_0;
+  b &= (0x7f<<14)|(0x7f);
   b = b<<8;
   a |= b;
 
@@ -784,8 +767,8 @@
   /* a: p0<<28 | p2<<14 | p4 (unmasked) */
   if (!(a&0x80))
   {
-    a &= SLOT_4_2_0;
-    b &= SLOT_4_2_0;
+    a &= (0x7f<<28)|(0x7f<<14)|(0x7f);
+    b &= (0x7f<<28)|(0x7f<<14)|(0x7f);
     b = b<<7;
     *v = a | b;
     return 5;