From a6f2b947358bd5a0bdb825af3ebe429ab43a3cb5 Mon Sep 17 00:00:00 2001 From: Andreas Florath Date: Thu, 20 Apr 2023 06:18:47 +0000 Subject: [PATCH] Fixed overflow_threshold overflow when using 256G of memory The current implementation using an 'int' runs into an overflow when specifying 256G of memory. This patch fixed the problem changing the 'int' into a 'long long'. Signed-off-by: Andreas Florath --- src/cooccur.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cooccur.c b/src/cooccur.c index 968f18a..ce9ff64 100644 --- a/src/cooccur.c +++ b/src/cooccur.c @@ -291,7 +291,7 @@ int get_cooccurrence() { // if symmetric > 0, we can increment ind twice per iteration, // meaning up to 2x window_size in one loop - int overflow_threshold = symmetric == 0 ? overflow_length - window_size : overflow_length - 2 * window_size; + long long const overflow_threshold = symmetric == 0 ? overflow_length - window_size : overflow_length - 2 * window_size; /* For each token in input stream, calculate a weighted cooccurrence sum within window_size */ while (1) {