Skip to content

Commit

Permalink
Fixed overflow_threshold overflow when using 256G of memory
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
florath authored and AngledLuffa committed Apr 20, 2023
1 parent 2cede75 commit a6f2b94
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cooccur.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit a6f2b94

Please sign in to comment.