diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2015-09-09 10:53:07 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2015-09-13 10:02:42 (GMT) |
commit | ded4e9a92670d0157cdcc5cbf7a4a1e3193e179a (patch) | |
tree | 644b3706cf39c3d7dd4acf28ce94dfa0d9ff4a4b /qtools | |
parent | 3941a16cc77f317329596b01294e021c150f88da (diff) | |
download | Doxygen-ded4e9a92670d0157cdcc5cbf7a4a1e3193e179a.zip Doxygen-ded4e9a92670d0157cdcc5cbf7a4a1e3193e179a.tar.gz Doxygen-ded4e9a92670d0157cdcc5cbf7a4a1e3193e179a.tar.bz2 |
Made several improvements to the performance of template engine
Diffstat (limited to 'qtools')
-rw-r--r-- | qtools/qgdict.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/qtools/qgdict.cpp b/qtools/qgdict.cpp index 2530986..4fe1a26 100644 --- a/qtools/qgdict.cpp +++ b/qtools/qgdict.cpp @@ -154,6 +154,32 @@ int QGDict::hashKeyAscii( const char *key ) return index; } +#if 0 +int QGDict::hashKeyAscii( const char *key ) +{ +#if defined(CHECK_NULL) + if ( key == 0 ) + { + qWarning( "QGDict::hashAsciiKey: Invalid null key" ); + return 0; + } +#endif + unsigned int hash = 5381; + int c; + // use djb2 by Dan Bernstein + if (cases) + { + while ((c=*key++)) hash = ((hash<<5)+hash)+c; + } + else + { + while ((c=*key++)) hash = ((hash<<5)+hash)+tolower(c); + } + int index = hash; + return index<0 ? -index : index; +} +#endif + #ifndef QT_NO_DATASTREAM /*! |