mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-01-21 03:55:00 +00:00
Fix compiler complaints about arithmetic overflow in hashing
This commit is contained in:
parent
93920d06e1
commit
c77c2a2b1e
6
pool.cpp
6
pool.cpp
@ -14,12 +14,12 @@ int swizzlecmp(const char *a, const char *b) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int hash1 = 0, hash2 = 0;
|
||||
long long hash1 = 0, hash2 = 0;
|
||||
for (ssize_t i = alen - 1; i >= 0; i--) {
|
||||
hash1 = hash1 * 37 + a[i];
|
||||
hash1 = (hash1 * 37 + a[i]) & INT_MAX;
|
||||
}
|
||||
for (ssize_t i = blen - 1; i >= 0; i--) {
|
||||
hash2 = hash2 * 37 + b[i];
|
||||
hash2 = (hash2 * 37 + b[i]) & INT_MAX;
|
||||
}
|
||||
|
||||
int h1 = hash1, h2 = hash2;
|
||||
|
Loading…
Reference in New Issue
Block a user