3 * File name: ir/common/ident_t.h
4 * Purpose: Hash table to store names -- private header.
5 * Author: Goetz Lindenmaier
9 * Copyright: (c) 1999-2003 Universität Karlsruhe
10 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
19 void init_ident (int initial_n_idents);
20 void finish_ident (void);
22 #define ID_HASH(str, len) \
23 ((( ((unsigned char *)(str))[0] * 33 \
24 + ((unsigned char *)(str))[(len)>>1]) * 31 \
25 + ((unsigned char *)(str))[(len)-1]) * 9 \
29 /* ------------------------ *
31 * ------------------------ */
35 __id_from_str(const char *str, int len)
38 return set_hinsert0(__id_set, str, len, ID_HASH(str, len));
41 static INLINE const char * __get_id_str(ident *id) { return (const char *)id->dptr; }
43 static INLINE int __get_id_strlen(ident *id) { return id->size; }
46 #define new_id_from_chars(str, len) __id_from_str(str, len)
47 #define get_id_str(id) __get_id_str(id)
48 #define get_id_strlen(id) __get_id_strlen(id)
50 # endif /* _IDENT_T_H_ */