summaryrefslogtreecommitdiff
path: root/src/hash.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2021-05-28 17:03:06 +1000
committerMaxime Coste <mawww@kakoune.org>2021-05-28 17:03:41 +1000
commite4a23a64faf56b5822fee13d976e038174408238 (patch)
tree16f2198e342de7e1237b98aa5795fe80114632e8 /src/hash.cc
parent38f85706ffabe33734a6759a3b19405b755fffb8 (diff)
Support opening files bigger than 2 GiB
The real technical limit is with lines bigger than 2 GiB and buffers with more than 2 Gi lines, refactor buffer loading to make it possible to load those files. Fix an overflow with the hash_data function at the same time
Diffstat (limited to 'src/hash.cc')
-rw-r--r--src/hash.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/hash.cc b/src/hash.cc
index ee3108c7..ecfd6e46 100644
--- a/src/hash.cc
+++ b/src/hash.cc
@@ -35,10 +35,10 @@ size_t hash_data(const char* input, size_t len)
constexpr uint32_t c1 = 0xcc9e2d51;
constexpr uint32_t c2 = 0x1b873593;
- const int nblocks = len / 4;
+ const ptrdiff_t nblocks = len / 4;
const uint8_t* blocks = data + nblocks*4;
- for (int i = -nblocks; i; ++i)
+ for (ptrdiff_t i = -nblocks; i; ++i)
{
uint32_t key;
memcpy(&key, blocks + 4*i, 4);