modules/up/src/gnug++/CacheKey.defs.h
/* [<][>][^][v][top][bottom][index][help] */
FUNCTIONS
This source file includes following functions.
- CacheKeyEQ
- CacheKeyLE
- CacheKeyCMP
- CacheKeyHASH
- HASHTABLE_TOO_CROWDED
1 // This may look like C code, but it is really -*- C++ -*-
2 /*
3 Copyright (C) 1988 Free Software Foundation
4 written by Doug Lea (dl@rocky.oswego.edu)
5
6 This file is part of the GNU C++ Library. This library is free
7 software; you can redistribute it and/or modify it under the terms of
8 the GNU Library General Public License as published by the Free
9 Software Foundation; either version 2 of the License, or (at your
10 option) any later version. This library is distributed in the hope
11 that it will be useful, but WITHOUT ANY WARRANTY; without even the
12 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 PURPOSE. See the GNU Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19
20 #ifndef _CacheKeydefs_h
21 #define _CacheKeydefs_h 1
22 #include "config.h"
23 #include "irr/cache_value.hh"
24
25 // equality operator
26 #ifndef CacheKeyEQ
27 #define CacheKeyEQ(a, b) ((a) == (b))
/* [<][>][^][v][top][bottom][index][help] */
28 #endif
29
30 // less-than-or-equal
31 #ifndef CacheKeyLE
32 #define CacheKeyLE(a, b) ((a) <= (b))
/* [<][>][^][v][top][bottom][index][help] */
33 #endif
34
35 // comparison : less-than -> < 0; equal -> 0; greater-than -> > 0
36 #ifndef CacheKeyCMP
37 #define CacheKeyCMP(a, b) ( ((a) <= (b))? (((a) == (b))? 0 : -1) : 1 )
/* [<][>][^][v][top][bottom][index][help] */
38 #endif
39
40 // hash function
41 #ifndef CacheKeyHASH
42 extern unsigned int hash(CacheKey );
43 #define CacheKeyHASH(x) hash(x)
/* [<][>][^][v][top][bottom][index][help] */
44 #endif
45
46 // initial capacity for structures requiring one
47
48 #ifndef DEFAULT_INITIAL_CAPACITY
49 #define DEFAULT_INITIAL_CAPACITY 100
50 #endif
51
52 // HASHTABLE_TOO_CROWDED(COUNT, SIZE) is true iff a hash table with COUNT
53 // elements and SIZE slots is too full, and should be resized.
54 // This is so if available space is less than 1/8.
55
56 #define HASHTABLE_TOO_CROWDED(COUNT, SIZE) ((SIZE) - ((SIZE) >> 3) <= (COUNT))
/* [<][>][^][v][top][bottom][index][help] */
57
58 #endif