/[hurd]/hurd-l4/libhurd-ihash/ihash.c
ViewVC logotype

Diff of /hurd-l4/libhurd-ihash/ihash.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by marcus, Sun Aug 17 04:02:38 2003 UTC revision 1.3 by marcus, Sun Aug 17 04:16:09 2003 UTC
# Line 24  Line 24 
24  #include <string.h>  #include <string.h>
25  #include <stdlib.h>  #include <stdlib.h>
26  #include <limits.h>  #include <limits.h>
27    #include <stdint.h>
28  #include <assert.h>  #include <assert.h>
29    
30  #include <hurd/ihash.h>  #include <hurd/ihash.h>
# Line 31  Line 32 
32    
33  /* The odd prime numbers greater than twice the last and less than  /* The odd prime numbers greater than twice the last and less than
34     2^40 (nobody needs more than 640 GB of memory).  */     2^40 (nobody needs more than 640 GB of memory).  */
35  static const unsigned int ihash_sizes[] =  static const uint64_t ihash_sizes[] =
36  {  {
37    3,    3,
38    7,    7,
# Line 62  static const unsigned int ihash_sizes[] Line 63  static const unsigned int ihash_sizes[]
63    359339171,    359339171,
64    718678369,    718678369,
65    1437356741,    1437356741,
66    2874713497,    UINT64_C (2874713497),
67    5749427029,    UINT64_C (5749427029),
68    11498854069,    UINT64_C (11498854069),
69    22997708177,    UINT64_C (22997708177),
70    45995416409,    UINT64_C (45995416409),
71    91990832831,    UINT64_C (91990832831),
72    183981665689,    UINT64_C (183981665689),
73    367963331389,    UINT64_C (367963331389),
74    735926662813    UINT64_C (735926662813)
75  };  };
76    
77    
# Line 282  hurd_ihash_add (hurd_ihash_t ht, hurd_ih Line 283  hurd_ihash_add (hurd_ihash_t ht, hurd_ih
283    for (i = 0; i < ihash_nsizes; i++)    for (i = 0; i < ihash_nsizes; i++)
284      if (ihash_sizes[i] > old_ht.size)      if (ihash_sizes[i] > old_ht.size)
285        break;        break;
286    if (i == ihash_nsizes)    if (i == ihash_nsizes
287          || ihash_sizes[i] > SIZE_MAX / sizeof (hurd_ihash_value_t)
288          || ihash_sizes[i] > SIZE_MAX / sizeof (hurd_ihash_key_t)
289          || ihash_sizes[i] > SIZE_MAX / sizeof (hurd_ihash_locp_t *))
290      return ENOMEM;              /* Surely will be true momentarily.  */      return ENOMEM;              /* Surely will be true momentarily.  */
291            
292    ht->size = ihash_sizes[i];    ht->size = ihash_sizes[i];

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26