Alle Hashfunktionen mit Primzahlen, evtl. bessere Performance.

This commit is contained in:
Enno Rehling 2004-05-26 06:42:58 +00:00
parent 6298a3a165
commit 5296949c1b
15 changed files with 16 additions and 16 deletions

View File

@ -104,7 +104,7 @@ typedef struct translation {
const char * value; const char * value;
} translation; } translation;
#define TRANSMAXHASH 255 #define TRANSMAXHASH 257
static translation * translation_table[TRANSMAXHASH]; static translation * translation_table[TRANSMAXHASH];
static translation * junkyard; static translation * junkyard;
@ -421,7 +421,7 @@ creport_cleanup(void)
/*static int msgno; */ /*static int msgno; */
#define MTMAXHASH 1023 #define MTMAXHASH 1021
static struct known_mtype { static struct known_mtype {
const struct message_type * mtype; const struct message_type * mtype;

View File

@ -2594,7 +2594,7 @@ prepare_report(faction * f)
#endif #endif
} }
#define FMAXHASH 1023 #define FMAXHASH 1021
struct fsee { struct fsee {
struct fsee * nexthash; struct fsee * nexthash;

View File

@ -137,7 +137,7 @@ buildingmaintenance(const building * b, const resource_type * rtype)
return cost; return cost;
} }
#define BMAXHASH 8191 #define BMAXHASH 7919
static building *buildhash[BMAXHASH]; static building *buildhash[BMAXHASH];
void void
bhash(building * b) bhash(building * b)

View File

@ -58,7 +58,7 @@
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
#define MAXENTITYHASH 8191 #define MAXENTITYHASH 7919
curse *cursehash[MAXENTITYHASH]; curse *cursehash[MAXENTITYHASH];
void void

View File

@ -562,7 +562,7 @@ ufindhash (int i)
return u; return u;
} }
#define FMAXHASH 2047 #define FMAXHASH 2039
faction * factionhash[FMAXHASH]; faction * factionhash[FMAXHASH];
void void

View File

@ -32,7 +32,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#define GMAXHASH 2047 #define GMAXHASH 2039
static group * ghash[GMAXHASH]; static group * ghash[GMAXHASH];
static int maxgid; static int maxgid;

View File

@ -19,7 +19,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <limits.h> #include <limits.h>
#define PMAXHASH 1023 #define PMAXHASH 1021
typedef struct player_hash { typedef struct player_hash {
struct player * entries; struct player * entries;

View File

@ -257,7 +257,7 @@ attrib_type at_moveblock = {
}; };
#define RMAXHASH 65535 #define RMAXHASH 65521
region *regionhash[RMAXHASH]; region *regionhash[RMAXHASH];
static region * static region *

View File

@ -907,7 +907,7 @@ get_addresses(faction * f)
} }
seen_region * reuse; seen_region * reuse;
#define MAXSEEHASH 4095 #define MAXSEEHASH 4999
seen_region * seehash[MAXSEEHASH]; seen_region * seehash[MAXSEEHASH];
void void

View File

@ -158,7 +158,7 @@ typedef struct uniquenode {
faction * f; faction * f;
} uniquenode; } uniquenode;
#define HASHSIZE 2047 #define HASHSIZE 2039
static uniquenode * uniquehash[HASHSIZE]; static uniquenode * uniquehash[HASHSIZE];
static faction * static faction *

View File

@ -84,7 +84,7 @@ st_register(const ship_type * type) {
shiptypes = stl; shiptypes = stl;
} }
#define SMAXHASH 8191 #define SMAXHASH 7919
ship *shiphash[SMAXHASH]; ship *shiphash[SMAXHASH];
void void
shash(ship * s) shash(ship * s)

View File

@ -74,7 +74,7 @@ u_unknown(void)
return &unknown; return &unknown;
} }
#define DMAXHASH 8191 #define DMAXHASH 7919
typedef struct dead { typedef struct dead {
struct dead * nexthash; struct dead * nexthash;
faction * f; faction * f;

View File

@ -21,7 +21,7 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#define MAXATHASH 63 #define MAXATHASH 61
attrib_type * at_hash[MAXATHASH]; attrib_type * at_hash[MAXATHASH];
static unsigned int static unsigned int

View File

@ -126,7 +126,7 @@ typedef struct messagetype_list {
const struct message_type * data; const struct message_type * data;
} messagetype_list; } messagetype_list;
#define MT_MAXHASH 1023 #define MT_MAXHASH 1021
static messagetype_list * messagetypes[MT_MAXHASH]; static messagetype_list * messagetypes[MT_MAXHASH];
const message_type * const message_type *

View File

@ -27,7 +27,7 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#define NRT_MAXHASH 1023 #define NRT_MAXHASH 1021
static nrmessage_type * messagetypes[NRT_MAXHASH]; static nrmessage_type * messagetypes[NRT_MAXHASH];
const char * const char *