summaryrefslogtreecommitdiff
path: root/sql/gen_lex_hash.cc
diff options
context:
space:
mode:
authormonty@donna.mysql.com <>2000-08-15 20:09:37 +0300
committermonty@donna.mysql.com <>2000-08-15 20:09:37 +0300
commitea013c2152301e459504451efdb17f4c9bb30877 (patch)
tree5f72e7444fbc3c8d944a66b54b26550a04e4f0be /sql/gen_lex_hash.cc
parent807460bbceceec25bf97352bc5e232c3e766d70f (diff)
downloadmariadb-git-ea013c2152301e459504451efdb17f4c9bb30877.tar.gz
Fixed for Ia64 + delayed key creation + a lot of small bug fixes
Diffstat (limited to 'sql/gen_lex_hash.cc')
-rw-r--r--sql/gen_lex_hash.cc19
1 files changed, 13 insertions, 6 deletions
diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc
index 3e1f6f15a6b..d3504b36d44 100644
--- a/sql/gen_lex_hash.cc
+++ b/sql/gen_lex_hash.cc
@@ -27,6 +27,7 @@
#include "lex.h"
bool opt_search=0,opt_verbose=0;
+ulong opt_count=100000;
#define max_allowed_array 8000 // Don't generate bigger arrays than this
#define max_symbol 32767 // Use this for 'not found'
@@ -316,6 +317,7 @@ void print_arrays()
static struct option long_options[] =
{
+ {"count", required_argument, 0, 'c'},
{"search", no_argument, 0, 'S'},
{"verbose", no_argument, 0, 'v'},
{"version", no_argument, 0, 'V'},
@@ -328,7 +330,7 @@ static struct option long_options[] =
static void usage(int version)
{
- printf("%s Ver 3.0 Distrib %s, for %s (%s)\n",
+ printf("%s Ver 3.1 Distrib %s, for %s (%s)\n",
my_progname, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
if (version)
return;
@@ -337,6 +339,7 @@ static void usage(int version)
puts("This program generates a perfect hashing function for the sql_lex.cc");
printf("Usage: %s [OPTIONS]\n", my_progname);
printf("\n\
+-c, --count=# Try count times to find a optimal hash table\n\
-r, --rnd1=# Set 1 part of rnd value for hash generator\n\
-R, --rnd2=# Set 2 part of rnd value for hash generator\n\
-t, --type=# Set type of char table to generate\n\
@@ -353,10 +356,13 @@ static int get_options(int argc, char **argv)
{
int c,option_index=0;
- while ((c=getopt_long(argc,argv,"?SvVr:R:t:",
+ while ((c=getopt_long(argc,argv,"?SvVc:r:R:t:",
long_options, &option_index)) != EOF)
{
switch(c) {
+ case 'c':
+ opt_count=atol(optarg);
+ break;
case 'r':
best_t1=atol(optarg);
break;
@@ -466,8 +472,7 @@ int main(int argc,char **argv)
int error;
MY_INIT(argv[0]);
- start_value=1277803L; best_t1=331678L; best_t2=4097229L; best_type=1;
- /* mode=5791 add=6 func_type: 0 */
+ start_value=6059524L; best_t1=2194873L; best_t2=4441039L; best_type=4; /* mode=4159 add=8 func_type: 0 */
if (get_options(argc,(char **) argv))
exit(1);
@@ -488,7 +493,7 @@ int main(int argc,char **argv)
start_value, best_t1,best_t2,best_type,best_mod,best_add,
best_functype);
- for (uint i=1 ; i <= 100000 ; i++)
+ for (uint i=1 ; i <= opt_count ; i++)
{
if (i % 10 == 0)
{
@@ -532,7 +537,9 @@ printf("/* This code is generated by gen_lex_hash.cc that seeks for a perfect\nh
print_arrays();
- printf("/* t1= %lu t2=%lu type= %d */\n\n",best_t1,best_t2,best_type);
+ printf("/* start_value=%ldL; best_t1=%ldL; best_t2=%ldL; best_type=%d; */ /* mode=%d add=%d type: %d */\n\n",
+ start_value, best_t1, best_t2,best_type,
+ best_mod, best_add, best_functype);
printf("inline SYMBOL *get_hash_symbol(const char *s,unsigned int length,bool function)\n\
{\n\