[flang-commits] [PATCH] D83428: [flang] Fix negative unit number hashing
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Wed Jul 8 17:59:55 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGcffc6036173d: [flang] Fix negative unit number hashing (authored by klausler).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D83428/new/
https://reviews.llvm.org/D83428
Files:
flang/runtime/unit-map.h
Index: flang/runtime/unit-map.h
===================================================================
--- flang/runtime/unit-map.h
+++ flang/runtime/unit-map.h
@@ -15,6 +15,7 @@
#include "lock.h"
#include "memory.h"
#include "unit.h"
+#include <cstdlib>
namespace Fortran::runtime::io {
@@ -59,7 +60,7 @@
};
static constexpr int buckets_{1031}; // must be prime
- int Hash(int n) { return n % buckets_; }
+ int Hash(int n) { return std::abs(n) % buckets_; }
ExternalFileUnit *Find(int n) {
Chain *previous{nullptr};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83428.276612.patch
Type: text/x-patch
Size: 542 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20200709/677b7b43/attachment.bin>
More information about the flang-commits
mailing list