diff options
author | Billy Donahue <billy.donahue@mongodb.com> | 2019-01-04 12:19:37 -0500 |
---|---|---|
committer | Billy Donahue <billy.donahue@mongodb.com> | 2019-01-07 12:08:23 -0500 |
commit | 11bb071e91461b1f8e40b9b15ddf3b9e1a2d23d1 (patch) | |
tree | 7037865f9bf4445fb3295ca7ce72f4182f012554 /src/mongo/platform | |
parent | 6a0a21214dd96663c899cb8f2562d6121351ed3c (diff) | |
download | mongo-11bb071e91461b1f8e40b9b15ddf3b9e1a2d23d1.tar.gz |
SERVER-36644 remove AtomicWord typedefs
Diffstat (limited to 'src/mongo/platform')
-rw-r--r-- | src/mongo/platform/atomic_word.h | 8 | ||||
-rw-r--r-- | src/mongo/platform/atomic_word_test.cpp | 24 |
2 files changed, 13 insertions, 19 deletions
diff --git a/src/mongo/platform/atomic_word.h b/src/mongo/platform/atomic_word.h index 5edbe2ae334..be65ae74ab6 100644 --- a/src/mongo/platform/atomic_word.h +++ b/src/mongo/platform/atomic_word.h @@ -183,7 +183,7 @@ public: } // namespace atomic_word_detail /** - * Instantiations of AtomicWord must be scalar types. + * Instantiations of AtomicWord must be trivially copyable. */ template <typename T> class AtomicWord : public atomic_word_detail::Base<T> { @@ -193,10 +193,4 @@ public: using atomic_word_detail::Base<T>::Base; }; -using AtomicUInt32 = AtomicWord<unsigned>; -using AtomicUInt64 = AtomicWord<unsigned long long>; -using AtomicInt32 = AtomicWord<int>; -using AtomicInt64 = AtomicWord<long long>; -using AtomicBool = AtomicWord<bool>; - } // namespace mongo diff --git a/src/mongo/platform/atomic_word_test.cpp b/src/mongo/platform/atomic_word_test.cpp index ed00ec3c70c..f097b995576 100644 --- a/src/mongo/platform/atomic_word_test.cpp +++ b/src/mongo/platform/atomic_word_test.cpp @@ -78,10 +78,10 @@ TEST(AtomicWordTests, BasicOperationsEnum) { } TEST(AtomicWordTests, BasicOperationsUnsigned32Bit) { - typedef AtomicUInt32::WordType WordType; - testAtomicWordBasicOperations<AtomicUInt32>(); + typedef unsigned WordType; + testAtomicWordBasicOperations<AtomicWord<unsigned>>(); - AtomicUInt32 w(0xdeadbeef); + AtomicWord<unsigned> w(0xdeadbeef); ASSERT_EQUALS(WordType(0xdeadbeef), w.compareAndSwap(0, 1)); ASSERT_EQUALS(WordType(0xdeadbeef), w.compareAndSwap(0xdeadbeef, 0xcafe1234)); ASSERT_EQUALS(WordType(0xcafe1234), w.fetchAndAdd(0xf000)); @@ -90,10 +90,10 @@ TEST(AtomicWordTests, BasicOperationsUnsigned32Bit) { } TEST(AtomicWordTests, BasicOperationsUnsigned64Bit) { - typedef AtomicUInt64::WordType WordType; - testAtomicWordBasicOperations<AtomicUInt64>(); + typedef unsigned long long WordType; + testAtomicWordBasicOperations<AtomicWord<unsigned long long>>(); - AtomicUInt64 w(0xdeadbeefcafe1234ULL); + AtomicWord<unsigned long long> w(0xdeadbeefcafe1234ULL); ASSERT_EQUALS(WordType(0xdeadbeefcafe1234ULL), w.compareAndSwap(0, 1)); ASSERT_EQUALS(WordType(0xdeadbeefcafe1234ULL), w.compareAndSwap(0xdeadbeefcafe1234ULL, 0xfedcba9876543210ULL)); @@ -103,10 +103,10 @@ TEST(AtomicWordTests, BasicOperationsUnsigned64Bit) { } TEST(AtomicWordTests, BasicOperationsSigned32Bit) { - typedef AtomicInt32::WordType WordType; - testAtomicWordBasicOperations<AtomicInt32>(); + typedef int WordType; + testAtomicWordBasicOperations<AtomicWord<int>>(); - AtomicInt32 w(0xdeadbeef); + AtomicWord<int> w(0xdeadbeef); ASSERT_EQUALS(WordType(0xdeadbeef), w.compareAndSwap(0, 1)); ASSERT_EQUALS(WordType(0xdeadbeef), w.compareAndSwap(0xdeadbeef, 0xcafe1234)); ASSERT_EQUALS(WordType(0xcafe1234), w.fetchAndAdd(0xf000)); @@ -115,10 +115,10 @@ TEST(AtomicWordTests, BasicOperationsSigned32Bit) { } TEST(AtomicWordTests, BasicOperationsSigned64Bit) { - typedef AtomicInt64::WordType WordType; - testAtomicWordBasicOperations<AtomicInt64>(); + typedef long long WordType; + testAtomicWordBasicOperations<AtomicWord<long long>>(); - AtomicInt64 w(0xdeadbeefcafe1234ULL); + AtomicWord<long long> w(0xdeadbeefcafe1234ULL); ASSERT_EQUALS(WordType(0xdeadbeefcafe1234LL), w.compareAndSwap(0, 1)); ASSERT_EQUALS(WordType(0xdeadbeefcafe1234LL), w.compareAndSwap(0xdeadbeefcafe1234LL, 0xfedcba9876543210LL)); |