/ Check-in [a70e9587]
Login

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

Overview
Comment:Faster implementation of hexToInt that uses not branches. Ticket #3047. (CVS 4992)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a70e9587569c99dd05e79c6745ff930aa31d763c
User & Date: drh 2008-04-11 19:37:56
Context
2008-04-11
21:20
Add the speedtest8inst1.c program for running speed tests with an instrumented VFS. (CVS 4993) check-in: baa8056c user: drh tags: trunk
19:37
Faster implementation of hexToInt that uses not branches. Ticket #3047. (CVS 4992) check-in: a70e9587 user: drh tags: trunk
19:18
Avoid the use of uninitialized variables in sqlite3GenerateRowIndexDelete. Ticket #3048. (CVS 4991) check-in: a93b7a34 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/util.c.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
...
615
616
617
618
619
620
621

622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637

638

639
640
641
642
643
644
645
**
*************************************************************************
** Utility functions used throughout sqlite.
**
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
** $Id: util.c,v 1.219 2008/04/05 18:41:43 drh Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
#include <ctype.h>


/*
................................................................................
#if !defined(SQLITE_OMIT_BLOB_LITERAL) || defined(SQLITE_HAS_CODEC)
/*
** Translate a single byte of Hex into an integer.
** This routinen only works if h really is a valid hexadecimal
** character:  0..9a..fA..F
*/
static int hexToInt(int h){

#if !defined(SQLITE_EBCDIC)
  int x = h - '0';
  if( x>9 ){
    x = (h - 'A' + 10) & 0xf;
  }
  assert( x>=0 && x<=15 );
  return x;
#else
  if( h>='0' && h<='9' ){
    return h - '0';
  }else if( h>='a' && h<='f' ){
    return h - 'a' + 10;
  }else{
    assert( h>='A' && h<='F' );
    return h - 'A' + 10;
  }

#endif

}
#endif /* !SQLITE_OMIT_BLOB_LITERAL || SQLITE_HAS_CODEC */

#if !defined(SQLITE_OMIT_BLOB_LITERAL) || defined(SQLITE_HAS_CODEC)
/*
** Convert a BLOB literal of the form "x'hhhhhh'" into its binary
** value.  Return a pointer to its binary value.  Space to hold the







|







 







>

<
|
<
<
<
<

<
<
<
<
<
<
<
<
>

>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
...
615
616
617
618
619
620
621
622
623

624




625








626
627
628
629
630
631
632
633
634
635
**
*************************************************************************
** Utility functions used throughout sqlite.
**
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
** $Id: util.c,v 1.220 2008/04/11 19:37:56 drh Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
#include <ctype.h>


/*
................................................................................
#if !defined(SQLITE_OMIT_BLOB_LITERAL) || defined(SQLITE_HAS_CODEC)
/*
** Translate a single byte of Hex into an integer.
** This routinen only works if h really is a valid hexadecimal
** character:  0..9a..fA..F
*/
static int hexToInt(int h){
  assert( (h>='0' && h<='9') ||  (h>='a' && h<='f') ||  (h>='A' && h<='F') );
#if !defined(SQLITE_EBCDIC)

  h += 9*(1&(h>>6));




#else








  h += 9*(1&~(h>>4));
#endif
  return h & 0xf;
}
#endif /* !SQLITE_OMIT_BLOB_LITERAL || SQLITE_HAS_CODEC */

#if !defined(SQLITE_OMIT_BLOB_LITERAL) || defined(SQLITE_HAS_CODEC)
/*
** Convert a BLOB literal of the form "x'hhhhhh'" into its binary
** value.  Return a pointer to its binary value.  Space to hold the