SQLite

Check-in [6de0ee4907]
Login

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

Overview
Comment:Attempt to work around a bug in the Borland BCC 5.5.1 compiler. Ticket #2880. (CVS 4705)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 6de0ee49073c7a47d5e10495b569b33df76d1448
User & Date: drh 2008-01-11 00:06:11.000
Context
2008-01-11
15:27
Do explicit range tests before attempting to convert a 64-bit float into a 64-bit integer. Some systems (windows) seem to throw exceptions if the conversion is out of range. Ticket #2880. (CVS 4706) (check-in: 4744257d3c user: drh tags: trunk)
00:06
Attempt to work around a bug in the Borland BCC 5.5.1 compiler. Ticket #2880. (CVS 4705) (check-in: 6de0ee4907 user: drh tags: trunk)
2008-01-10
23:50
More work toward converting the VM into a register-based machine. (CVS 4704) (check-in: 8cbd46517f user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/vdbemem.c.
351
352
353
354
355
356
357

















358


359
360
361
362
363
364
365
/*
** The MEM structure is already a MEM_Real.  Try to also make it a
** MEM_Int if we can.
*/
void sqlite3VdbeIntegerAffinity(Mem *pMem){
  assert( pMem->flags & MEM_Real );
  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );

















  pMem->u.i = pMem->r;


  if( ((double)pMem->u.i)==pMem->r ){
    pMem->flags |= MEM_Int;
  }
}

/*
** Convert pMem to type integer.  Invalidate any prior representations.







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

>
>







351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
/*
** The MEM structure is already a MEM_Real.  Try to also make it a
** MEM_Int if we can.
*/
void sqlite3VdbeIntegerAffinity(Mem *pMem){
  assert( pMem->flags & MEM_Real );
  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );

  /* It is reported (in ticket #2880) that the BCC 5.5.1 compiler
  ** will corrupt a floating point number on the right-hand side
  ** of an assignment if the lvalue for the assignment is an integer.
  **
  ** We will attempt to work around this bug in the Borland compiler
  ** by moving the value into a temporary variable first so that if
  ** the assignment into the integer really does corrupt the right-hand
  ** side value, it will corrupt a temporary variable that we do not
  ** care about.
  */
#ifdef __BORLANDC__
  {
    double r = pMem->r;
    pMem->u.i = r;
  }
#else
  pMem->u.i = pMem->r;
#endif

  if( ((double)pMem->u.i)==pMem->r ){
    pMem->flags |= MEM_Int;
  }
}

/*
** Convert pMem to type integer.  Invalidate any prior representations.