2aa19470d49766bcae98f1e0cf07763e6db9638f
[libfirm] / ir / ident / ident_t.h
1 /*
2  * Project:     libFIRM
3  * File name:   ir/common/ident_t.h
4  * Purpose:     Hash table to store names -- private header.
5  * Author:      Goetz Lindenmaier
6  * Modified by:
7  * Created:
8  * CVS-ID:      $Id$
9  * Copyright:   (c) 1999-2003 Universität Karlsruhe
10  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
11  */
12
13 # ifndef _IDENT_T_H_
14 # define _IDENT_T_H_
15
16 # include "ident.h"
17
18 /**
19  * Initialize the ident module.
20  *
21  * @param id_if             The ident module interface, if NULL, the default
22  *                          libFirm ident module will be used.
23  * @param initial_n_idents  Only used in the default libFirm ident module, initial
24  *                          number of entries in the hash table.
25  */
26 void init_ident (ident_if_t *id_if, int initial_n_idents);
27
28 /**
29  * Finishes the ident module, frees all entries.
30  */
31 void finish_ident (void);
32
33 /** The hash function of the internal ident module implementation. */
34 #define ID_HASH(str, len) \
35   (((  ((unsigned char *)(str))[0] * 33 \
36      + ((unsigned char *)(str))[(len)>>1]) * 31 \
37     + ((unsigned char *)(str))[(len)-1]) * 9 \
38    + (len))
39
40 # endif /* _IDENT_T_H_ */