[mathicgb] 100/393: Hash table not initializes itself to null as it should. It seems MSVC was doing this while GCC was not - std::atomic has trivial constructor so that may be the difference.
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Fri Apr 3 15:58:40 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch upstream
in repository mathicgb.
commit 25ead0bc48d0a13edce5033155a6ab8c92152cad
Author: Bjarke Hammersholt Roune <bjarkehr.code at gmail.com>
Date: Mon Nov 5 22:19:51 2012 +0100
Hash table not initializes itself to null as it should. It seems MSVC was doing this while GCC was not - std::atomic has trivial constructor so that may be the difference.
---
src/mathicgb/FixedSizeMonomialMap.h | 4 ++--
src/mathicgb/stdinc.h | 13 +++++++++----
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/mathicgb/FixedSizeMonomialMap.h b/src/mathicgb/FixedSizeMonomialMap.h
index 93645cb..fc3fe5e 100755
--- a/src/mathicgb/FixedSizeMonomialMap.h
+++ b/src/mathicgb/FixedSizeMonomialMap.h
@@ -34,7 +34,7 @@ public:
):
mHashToIndexMask(computeHashMask(requestedBucketCount)),
mBuckets(
- make_unique_array<Atomic<Node*>>(hashMaskToBucketCount(mHashToIndexMask))
+ make_unique_array_init<Atomic<Node*>>(hashMaskToBucketCount(mHashToIndexMask))
),
mRing(ring),
mNodeAlloc(sizeofNode(ring)) {}
@@ -53,7 +53,7 @@ public:
):
mHashToIndexMask(computeHashMask(requestedBucketCount)),
mBuckets(
- make_unique_array<Atomic<Node*>>(hashMaskToBucketCount(mHashToIndexMask))
+ make_unique_array_init<Atomic<Node*>>(hashMaskToBucketCount(mHashToIndexMask))
),
mRing(map.ring()),
mNodeAlloc(std::move(map.mNodeAlloc))
diff --git a/src/mathicgb/stdinc.h b/src/mathicgb/stdinc.h
index 220dea6..db5c4dc 100755
--- a/src/mathicgb/stdinc.h
+++ b/src/mathicgb/stdinc.h
@@ -62,10 +62,10 @@
#pragma warning (disable: 4355)
#if defined (_M_IX86) || defined(_M_X64) // if on x86 (32 bit) or x64 (64 bit)
-#define MATHICGB_USE_CUSTOM_ATOMIC_X86_X64_MSVC_4BYTE
-#endif
-#ifdef _M_X64 // if on x64 (64 bit)
-#define MATHICGB_USE_CUSTOM_ATOMIC_X86_X64_MSVC_8BYTE
+#define MATHICGB_USE_CUSTOM_ATOMIC_X86_X64_MSVC_4BYTE
+#endif
+#ifdef _M_X64 // if on x64 (64 bit)
+#define MATHICGB_USE_CUSTOM_ATOMIC_X86_X64_MSVC_8BYTE
#endif
#elif defined (__GNUC__) // GCC compiler
@@ -233,6 +233,11 @@ std::unique_ptr<T[]> make_unique_array(size_t count) {
return std::unique_ptr<T[]>(new T[count]);
}
+template<class T>
+std::unique_ptr<T[]> make_unique_array_init(size_t count) {
+ return std::unique_ptr<T[]>(new T[count]());
+}
+
// TODO: These types should be defined in some way that actually
// checks that these bit counts are right like in a configure script.
typedef unsigned long long uint64;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mathicgb.git
More information about the debian-science-commits
mailing list