]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Faster implementation of hexToInt that uses not branches. Ticket #3047. (CVS 4992)
authordrh <drh@noemail.net>
Fri, 11 Apr 2008 19:37:55 +0000 (19:37 +0000)
committerdrh <drh@noemail.net>
Fri, 11 Apr 2008 19:37:55 +0000 (19:37 +0000)
FossilOrigin-Name: a70e9587569c99dd05e79c6745ff930aa31d763c

manifest
manifest.uuid
src/util.c

index 8b0545f6b2bc41e8d765b41f79da94d0f1b04a1d..b4875f12991f82c42cfa015311f46d633ae046e8 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Avoid\sthe\suse\sof\suninitialized\svariables\sin\ssqlite3GenerateRowIndexDelete.\nTicket\s#3048.\s(CVS\s4991)
-D 2008-04-11T19:18:25
+C Faster\simplementation\sof\shexToInt\sthat\suses\snot\sbranches.\s\sTicket\s#3047.\s(CVS\s4992)
+D 2008-04-11T19:37:56
 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
 F Makefile.in b861627d91df5ee422c54237aa38296954dc0151
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -173,7 +173,7 @@ F src/tokenize.c a96abe15a8db6fea2e964cdce2acba9ed17bc26f
 F src/trigger.c 9bd3b6fa0beff4a02d262c96466f752ec15a7fc3
 F src/update.c d6f214aad7eab5aaec5f966058b0828b3f7d6706
 F src/utf.c 8c94fa10efc78c2568d08d436acc59df4df7191b
-F src/util.c 02c57c302ef738ff5b554953c12d8f919e501583
+F src/util.c 719bcd7f088badb19dfa10f2542f1ef54e673da5
 F src/vacuum.c 3524411bfb58aac0d87eadd3e5b7cd532772af30
 F src/vdbe.c 444ab9ecc91f3c04b2b29ae604458426aa674fa6
 F src/vdbe.h bfd84bda447f39cb599302c7ec85067dae20453c
@@ -627,7 +627,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P 03c0279d7b004ccc4264143e366c793b4d774f9f
-R 72b1ed2a0366710f33a40f7fc1d822b1
+P a93b7a344a713a9ed9d72be4707eb28c2979648c
+R ad4db1f58ad5d1e909c90f01c6018ce9
 U drh
-Z 00cf749f4a1eca48ead98ab1077543fc
+Z edd38be2c3330bd5c64978b55d0e6a92
index f1baf4d25019e21422498e15eb3ee93e4954225f..858fea061e2d161ff0eb53c0ab589933fcfaab00 100644 (file)
@@ -1 +1 @@
-a93b7a344a713a9ed9d72be4707eb28c2979648c
\ No newline at end of file
+a70e9587569c99dd05e79c6745ff930aa31d763c
\ No newline at end of file
index 22046dad659addb0509bbf658a0643242e98fbc9..98d8a908b8343c1bb8382324248b2f184da2aec2 100644 (file)
@@ -14,7 +14,7 @@
 ** 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 $
+** $Id: util.c,v 1.220 2008/04/11 19:37:56 drh Exp $
 */
 #include "sqliteInt.h"
 #include <stdarg.h>
@@ -619,23 +619,13 @@ void sqlite3Put4byte(unsigned char *p, u32 v){
 ** 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)
-  int x = h - '0';
-  if( x>9 ){
-    x = (h - 'A' + 10) & 0xf;
-  }
-  assert( x>=0 && x<=15 );
-  return x;
+  h += 9*(1&(h>>6));
 #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;
-  }
+  h += 9*(1&~(h>>4));
 #endif
+  return h & 0xf;
 }
 #endif /* !SQLITE_OMIT_BLOB_LITERAL || SQLITE_HAS_CODEC */