mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 08:25:40 +02:00
Move string hashing from mbtiles to text
This commit is contained in:
-13
@@ -101,19 +101,6 @@ sqlite3 *mbtiles_open(char *dbname, char **argv, int forcetable) {
|
||||
return outdb;
|
||||
}
|
||||
|
||||
unsigned long long fnv1a(std::string const &s) {
|
||||
// Store tiles by a hash of their contents (fnv1a 64-bit)
|
||||
// http://www.isthe.com/chongo/tech/comp/fnv/
|
||||
const unsigned long long fnv_offset_basis = 14695981039346656037u;
|
||||
const unsigned long long fnv_prime = 1099511628211u;
|
||||
unsigned long long h = fnv_offset_basis;
|
||||
for (size_t i = 0; i < s.size(); i++) {
|
||||
h ^= (unsigned char) s[i];
|
||||
h *= fnv_prime;
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
void mbtiles_write_tile(sqlite3 *outdb, int z, int tx, int ty, const char *data, int size) {
|
||||
std::string hash = std::to_string(fnv1a(std::string(data, size)));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user