Oh GACK! src-clean doesn't quite work that easily since cleandist rebuilds the
[unix-history] / gnu / lib / libg++ / g++-include / gen / defs.hP
CommitLineData
e87b4ac1
PR
1// This may look like C code, but it is really -*- C++ -*-
2/*
3Copyright (C) 1988 Free Software Foundation
4 written by Doug Lea (dl@rocky.oswego.edu)
5
6This file is part of the GNU C++ Library. This library is free
7software; you can redistribute it and/or modify it under the terms of
8the GNU Library General Public License as published by the Free
9Software Foundation; either version 2 of the License, or (at your
10option) any later version. This library is distributed in the hope
11that it will be useful, but WITHOUT ANY WARRANTY; without even the
12implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13PURPOSE. See the GNU Library General Public License for more details.
14You should have received a copy of the GNU Library General Public
15License along with this library; if not, write to the Free Software
16Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
17*/
18
19
20#ifndef _<T>defs_h
21#define _<T>defs_h 1
22
23
24// equality operator
25#ifndef <T>EQ
26#define <T>EQ(a, b) ((a) == (b))
27#endif
28
29// less-than-or-equal
30#ifndef <T>LE
31#define <T>LE(a, b) ((a) <= (b))
32#endif
33
34// comparison : less-than -> < 0; equal -> 0; greater-than -> > 0
35#ifndef <T>CMP
36#define <T>CMP(a, b) ( ((a) <= (b))? (((a) == (b))? 0 : -1) : 1 )
37#endif
38
39// hash function
40#ifndef <T>HASH
41extern unsigned int hash(<T&>);
42#define <T>HASH(x) hash(x)
43#endif
44
45// initial capacity for structures requiring one
46
47#ifndef DEFAULT_INITIAL_CAPACITY
48#define DEFAULT_INITIAL_CAPACITY 100
49#endif
50
51// HASHTABLE_TOO_CROWDED(COUNT, SIZE) is true iff a hash table with COUNT
52// elements and SIZE slots is too full, and should be resized.
53// This is so if available space is less than 1/8.
54
55#define HASHTABLE_TOO_CROWDED(COUNT, SIZE) ((SIZE) - ((SIZE) >> 3) <= (COUNT))
56
57#endif