1 /* mkhash.h --- provide ‘MAKE_HASH_TABLE’
2    serial 1
3 
4    Copyright (C) 2013 Thien-Thi Nguyen
5 
6    This is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3, or (at your option)
9    any later version.
10 
11    This software is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15 
16    You should have received a copy of the GNU General Public License
17    along with this package; see the file COPYING.  If not, write to the
18    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19    Boston, MA  02110-1301  USA.
20 */
21 
22 #if GI_LEVEL_1_8
23 
24 #define MAKE_HASH_TABLE(size)                   \
25   scm_c_make_hash_table (size)
26 
27 #else  /* !GI_LEVEL_1_8 */
28 
29 #define __REASONABLE_NBUCKETS(count)            \
30   (((count) <= 23) ? 5                          \
31    : (((count) <= 113) ? 23                     \
32       : (((count) <= 211) ? 57                  \
33          : 113)))
34 
35 #define MAKE_HASH_TABLE(size)                   \
36   (scm_make_vector                              \
37    (NUM_INT (__REASONABLE_NBUCKETS (size)),     \
38     SCM_EOL))
39 
40 #endif /* !GI_LEVEL_1_8 */
41 
42 /* mkhash.h ends here */
43