SQLite

Changes On Branch builtin-bswap64
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch builtin-bswap64 Excluding Merge-Ins

This is equivalent to a diff from 97914266 to e42ed9b4

2017-01-16
18:10
Back out check-in [0b3174e0b1364c] and replace it with a better fix for \ticket [91e2e8ba6ff2e2] - a fix that does not cause the problem identified by ticket [7ffd1ca1d2ad4ec]. Add new test cases for both tickets. (check-in: 9b64af7b user: drh tags: trunk)
16:01
Add test cases for tickets [91e2e8ba6ff2e2] and [7ffd1ca1d2ad4ec]. (check-in: 9d0dfe0b user: drh tags: automatic-index-affinity)
11:54
An example showing how to improve performance of sqlite3VdbeSerialPut() using the GCC intrinsic function __builtin_bswap64(). (Leaf check-in: e42ed9b4 user: drh tags: builtin-bswap64)
2017-01-13
22:21
Merge updates from trunk. (check-in: 8b42b8e3 user: mistachkin tags: winSectorSize)
18:24
Fix a problem preventing resumption of RBU operations after recovering from a process or system failure that occurs during the incremental-checkpoint phase. (check-in: 97914266 user: dan tags: trunk)
12:53
Fix the build for SQLITE_ENABLE_MEMORY_MANAGEMENT. (check-in: 8c85b8fd user: drh tags: trunk)

Changes to src/vdbeaux.c.

3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328


3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355












3356
3357
3358
3359
3360
3361
3362
3317
3318
3319
3320
3321
3322
3323





3324
3325















3326
3327
3328
3329
3330
3331
3332
3333
3334
3335


3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354







-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-










-
-
+
+
+
+
+
+
+
+
+
+
+
+







**
** Return the number of bytes actually written into buf[].  The number
** of bytes in the zero-filled tail is included in the return value only
** if those bytes were zeroed in buf[].
*/ 
u32 sqlite3VdbeSerialPut(u8 *buf, Mem *pMem, u32 serial_type){
  u32 len;

  /* Integer and Real */
  if( serial_type<=7 && serial_type>0 ){
    u64 v;
    u32 i;
  u64 v;
  u32 i;
    if( serial_type==7 ){
      assert( sizeof(v)==sizeof(pMem->u.r) );
      memcpy(&v, &pMem->u.r, sizeof(v));
      swapMixedEndianFloat(v);
    }else{
      v = pMem->u.i;
    }
    len = i = sqlite3SmallTypeSizes[serial_type];
    assert( i>0 );
    do{
      buf[--i] = (u8)(v&0xFF);
      v >>= 8;
    }while( i );
    return len;
  }

  /* String or blob */
  if( serial_type>=12 ){
    assert( pMem->n + ((pMem->flags & MEM_Zero)?pMem->u.nZero:0)
             == (int)sqlite3VdbeSerialTypeLen(serial_type) );
    len = pMem->n;
    if( len>0 ) memcpy(buf, pMem->z, len);
    return len;
  }

  /* NULL or constants 0 or 1 */
  return 0;
  /* Integer and Real */
  if( serial_type==7 ){
    assert( sizeof(v)==sizeof(pMem->u.r) );
    memcpy(&v, &pMem->u.r, sizeof(v));
    swapMixedEndianFloat(v);
  }else{
    v = pMem->u.i;
  }
  len = i = sqlite3SmallTypeSizes[serial_type];
  v = __builtin_bswap64(v);
  memcpy(buf, &((char*)&v)[8-i], i);
  return len;
}

/* Input "x" is a sequence of unsigned characters that represent a
** big-endian integer.  Return the equivalent native integer
*/
#define ONE_BYTE_INT(x)    ((i8)(x)[0])
#define TWO_BYTE_INT(x)    (256*(i8)((x)[0])|(x)[1])