File: 0001-Prevent-overflow-on-32-bit-architectures.patch

package info (click to toggle)
ripser 1.2.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 7,436 kB
  • sloc: cpp: 1,053; python: 59; makefile: 28
file content (21 lines) | stat: -rw-r--r-- 641 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
From: Gard Spreemann <gspr@nonempty.org>
Date: Sun, 8 Mar 2020 15:14:54 +0100
Subject: Prevent overflow on 32 bit architectures.

---
 ripser.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ripser.cpp b/ripser.cpp
index cfa01a8..7f66847 100644
--- a/ripser.cpp
+++ b/ripser.cpp
@@ -82,7 +82,7 @@ static const std::string clear_line("\r\033[K");
 static const size_t num_coefficient_bits = 8;
 
 static const index_t max_simplex_index =
-    (1l << (8 * sizeof(index_t) - 1 - num_coefficient_bits)) - 1;
+  ((index_t)1 << (8 * sizeof(index_t) - 1 - num_coefficient_bits)) - 1;
 
 void check_overflow(index_t i) {
 	if