Crossfire Server, Trunk
shstr.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  shared_string
 

Macros

#define GATHER(n)
 
#define MAXSTRING   20
 
#define offsetof(type, member)   (int)&(((type *)0)->member)
 
#define PADDING   ((2*sizeof(long)-sizeof(REFCOUNT_TYPE))%sizeof(long))+1
 
#define REFCOUNT_TYPE   int
 
#define SS(x)   ((shared_string *) ((x)-offsetof(shared_string, string)))
 
#define SS_DUMP_TABLE   1
 
#define SS_DUMP_TOTALS   2
 
#define TABLESIZE   4133
 
#define TOPBIT   ((unsigned REFCOUNT_TYPE)1<<(sizeof(REFCOUNT_TYPE)*CHAR_BIT-1))
 

Detailed Description

Shared-strings defines.

Definition in file shstr.h.

Macro Definition Documentation

◆ GATHER

#define GATHER (   n)

Definition at line 60 of file shstr.h.

◆ MAXSTRING

#define MAXSTRING   20

This specifies how many characters the hashing routine should look at. You may actually save CPU by increasing this number if the typical string is large.

Definition at line 21 of file shstr.h.

◆ offsetof

#define offsetof (   type,
  member 
)    (int)&(((type *)0)->member)

The offsetof macro is part of ANSI C, but many compilers lack it, for example "gcc -ansi"

Definition at line 37 of file shstr.h.

◆ PADDING

#define PADDING   ((2*sizeof(long)-sizeof(REFCOUNT_TYPE))%sizeof(long))+1

Definition at line 65 of file shstr.h.

◆ REFCOUNT_TYPE

#define REFCOUNT_TYPE   int

In the unlikely occurence that 16383 references to a string are too few, you can modify the below type to something bigger. (The top bit of "refcount" is used to signify that "u.array" points at the array entry.)

Definition at line 30 of file shstr.h.

◆ SS

#define SS (   x)    ((shared_string *) ((x)-offsetof(shared_string, string)))

SS(string) will return the address of the shared_string struct which contains "string".

Definition at line 44 of file shstr.h.

◆ SS_DUMP_TABLE

#define SS_DUMP_TABLE   1

Definition at line 46 of file shstr.h.

◆ SS_DUMP_TOTALS

#define SS_DUMP_TOTALS   2

Definition at line 47 of file shstr.h.

◆ TABLESIZE

#define TABLESIZE   4133

The size of the shared strings hashtable. This must be smaller than 32767, but 947 ought to be plenty enough.

Definition at line 13 of file shstr.h.

◆ TOPBIT

#define TOPBIT   ((unsigned REFCOUNT_TYPE)1<<(sizeof(REFCOUNT_TYPE)*CHAR_BIT-1))

Definition at line 63 of file shstr.h.