We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 86ec6c4 commit 2ae43c5Copy full SHA for 2ae43c5
libdispatch/nchashmap.c
@@ -68,6 +68,10 @@ extern nchashkey_t hash_fast(const char*, size_t length);
68
69
#define MAX(a,b) ((a) > (b) ? (a) : (b))
70
71
+#ifndef SIZE_MAX
72
+#define SIZE_MAX ((size_t)-1)
73
+#endif
74
+
75
/* Forward */
76
static const unsigned int NC_nprimes;
77
static const unsigned int NC_primes[16386];
@@ -175,7 +179,7 @@ NC_hashmapnew(size_t startsize)
175
179
if(startsize == 0 || startsize < MINTABLESIZE)
176
180
startsize = MINTABLESIZE;
177
181
else {
178
- if(startsize > (size_t - 1) / 4){nullfree(hm);return 0;}
182
+ if(startsize > SIZE_MAX / 4){nullfree(hm);return 0;}
183
startsize *= 4;
184
startsize /= 3;
185
startsize = findPrimeGreaterThan(startsize);
0 commit comments