mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 08:25:40 +02:00
Just use a standard C++ type for deduplicating instead of reinventing the wheel
This commit is contained in:
@@ -67,32 +67,6 @@ struct pool_val *pool(struct pool *p, char *s, int type) {
|
||||
return pool1(p, s, type, strcmp);
|
||||
}
|
||||
|
||||
static long long mangle(long long in) {
|
||||
int i;
|
||||
long long out = 0;
|
||||
for (i = 0; i < 64; i++) {
|
||||
out |= ((in >> i) & 1) << (63 - i);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
static int llcmp(const char *v1, const char *v2) {
|
||||
long long ll1 = mangle(*(long long *) v1);
|
||||
long long ll2 = mangle(*(long long *) v2);
|
||||
|
||||
if (ll1 < ll2) {
|
||||
return -1;
|
||||
} else if (ll1 > ll2) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
struct pool_val *pool_long_long(struct pool *p, long long *s, int type) {
|
||||
return pool1(p, (char *) s, type, llcmp);
|
||||
}
|
||||
|
||||
void pool_free1(struct pool *p, void (*func)(void *)) {
|
||||
while (p->head != NULL) {
|
||||
if (func != NULL) {
|
||||
|
||||
Reference in New Issue
Block a user