Skip to content

Commit 2ae43c5

Browse files
committed
Fix macro SIZE_MAX
1 parent 86ec6c4 commit 2ae43c5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

libdispatch/nchashmap.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ extern nchashkey_t hash_fast(const char*, size_t length);
6868

6969
#define MAX(a,b) ((a) > (b) ? (a) : (b))
7070

71+
#ifndef SIZE_MAX
72+
#define SIZE_MAX ((size_t)-1)
73+
#endif
74+
7175
/* Forward */
7276
static const unsigned int NC_nprimes;
7377
static const unsigned int NC_primes[16386];
@@ -175,7 +179,7 @@ NC_hashmapnew(size_t startsize)
175179
if(startsize == 0 || startsize < MINTABLESIZE)
176180
startsize = MINTABLESIZE;
177181
else {
178-
if(startsize > (size_t - 1) / 4){nullfree(hm);return 0;}
182+
if(startsize > SIZE_MAX / 4){nullfree(hm);return 0;}
179183
startsize *= 4;
180184
startsize /= 3;
181185
startsize = findPrimeGreaterThan(startsize);

0 commit comments

Comments
 (0)