summaryrefslogtreecommitdiffstats
path: root/mfbt
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
commit8dd16259287f58f9273002717ec4d27e97127719 (patch)
tree3863e62a53829a84037444beab3abd4ed9dfc7d0 /mfbt
parentReleasing progress-linux version 126.0.1-1~progress7.99u1. (diff)
downloadfirefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz
firefox-8dd16259287f58f9273002717ec4d27e97127719.zip
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mfbt')
-rw-r--r--mfbt/Assertions.h8
-rw-r--r--mfbt/FunctionRef.h3
-rw-r--r--mfbt/MPSCQueue.h374
-rw-r--r--mfbt/Result.h9
-rw-r--r--mfbt/Span.h26
-rw-r--r--mfbt/moz.build1
-rw-r--r--mfbt/tests/TestAtomicBitfields.cpp62
-rw-r--r--mfbt/tests/TestEnumTypeTraits.cpp2
-rw-r--r--mfbt/tests/TestFloatingPoint.cpp12
-rw-r--r--mfbt/tests/TestMPSCQueue.cpp169
-rw-r--r--mfbt/tests/TestMathAlgorithms.cpp998
-rw-r--r--mfbt/tests/TestMaybe.cpp14
-rw-r--r--mfbt/tests/TestRefPtr.cpp2
-rw-r--r--mfbt/tests/TestResult.cpp45
-rw-r--r--mfbt/tests/TestUniquePtr.cpp11
-rw-r--r--mfbt/tests/TestVector.cpp72
-rw-r--r--mfbt/tests/moz.build1
17 files changed, 1312 insertions, 497 deletions
diff --git a/mfbt/Assertions.h b/mfbt/Assertions.h
index 53b2930bf7..0b7395177d 100644
--- a/mfbt/Assertions.h
+++ b/mfbt/Assertions.h
@@ -214,10 +214,10 @@ MOZ_NoReturn(int aLine) {
MOZ_ASSUME_UNREACHABLE_MARKER();
}
-# define MOZ_REALLY_CRASH(line) \
- do { \
- __debugbreak(); \
- MOZ_NoReturn(line); \
+# define MOZ_REALLY_CRASH(line) \
+ do { \
+ MOZ_NOMERGE __debugbreak(); \
+ MOZ_NoReturn(line); \
} while (false)
#elif __wasi__
diff --git a/mfbt/FunctionRef.h b/mfbt/FunctionRef.h
index 374173d884..305cc25282 100644
--- a/mfbt/FunctionRef.h
+++ b/mfbt/FunctionRef.h
@@ -176,7 +176,8 @@ class MOZ_TEMPORARY_CLASS FunctionRef<Ret(Params...)> {
FunctionRef>>* = nullptr>
MOZ_IMPLICIT FunctionRef(Callable&& aCallable MOZ_LIFETIME_BOUND) noexcept
: mAdaptor([](const Payload& aPayload, Params... aParams) {
- auto& func = *static_cast<std::remove_reference_t<Callable>*>(aPayload.mObject);
+ auto& func = *static_cast<std::remove_reference_t<Callable>*>(
+ aPayload.mObject);
return static_cast<Ret>(func(std::forward<Params>(aParams)...));
}) {
::new (KnownNotNull, &mPayload.mObject) void*(&aCallable);
diff --git a/mfbt/MPSCQueue.h b/mfbt/MPSCQueue.h
new file mode 100644
index 0000000000..a413fd63bc
--- /dev/null
+++ b/mfbt/MPSCQueue.h
@@ -0,0 +1,374 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/*
+ * Multiple Producer Single Consumer lock-free queue.
+ * Allocation-free is guaranteed outside of the constructor.
+ *
+ * This is a direct C++ port from
+ * https://docs.rs/signal-hook/0.3.17/src/signal_hook/low_level/channel.rs.html#1-235
+ * with the exception we are using atomic uint64t to have 15 slots in the ring
+ * buffer (Rust implem is 5 slots, we want a bit more).
+ * */
+
+#ifndef mozilla_MPSCQueue_h
+#define mozilla_MPSCQueue_h
+
+#include "mozilla/Assertions.h"
+#include "mozilla/Attributes.h"
+#include "mozilla/PodOperations.h"
+#include <algorithm>
+#include <atomic>
+#include <cstddef>
+#include <limits>
+#include <memory>
+#include <thread>
+#include <type_traits>
+#include <optional>
+#include <inttypes.h>
+
+namespace mozilla {
+
+namespace detail {
+template <typename T, bool IsPod = std::is_trivial<T>::value>
+struct MemoryOperations {
+ /**
+ * This allows either moving (if T supports it) or copying a number of
+ * elements from a `aSource` pointer to a `aDestination` pointer.
+ * If it is safe to do so and this call copies, this uses PodCopy. Otherwise,
+ * constructors and destructors are called in a loop.
+ */
+ static void MoveOrCopy(T* aDestination, T* aSource, size_t aCount);
+};
+
+template <typename T>
+struct MemoryOperations<T, true> {
+ static void MoveOrCopy(T* aDestination, T* aSource, size_t aCount) {
+ PodCopy(aDestination, aSource, aCount);
+ }
+};
+
+template <typename T>
+struct MemoryOperations<T, false> {
+ static void MoveOrCopy(T* aDestination, T* aSource, size_t aCount) {
+ std::move(aSource, aSource + aCount, aDestination);
+ }
+};
+} // namespace detail
+
+static const bool MPSC_DEBUG = false;
+
+static const size_t kMaxCapacity = 16;
+
+/**
+ * This data structure allows producing data from several threads, and consuming
+ * it on one thread, safely and without performing memory allocations or
+ * locking.
+ *
+ * The role for the producers and the consumer must be constant, i.e., the
+ * producer should always be on one thread and the consumer should always be on
+ * another thread.
+ *
+ * Some words about the inner workings of this class:
+ * - Capacity is fixed. Only one allocation is performed, in the constructor.
+ * - Maximum capacity is 15 elements, with 0 being used to denote an empty set.
+ * This is a hard limitation from encoding indexes within the atomic uint64_t.
+ * - This is lock-free but not wait-free, it might spin a little until
+ * compare/exchange succeeds.
+ * - There is no guarantee of forward progression for individual threads.
+ * - This should be safe to use from a signal handler context.
+ */
+template <typename T>
+class MPSCRingBufferBase {
+ public:
+ explicit MPSCRingBufferBase(size_t aCapacity)
+ : mFree(0), mOccupied(0), mCapacity(aCapacity + 1) {
+ MOZ_RELEASE_ASSERT(aCapacity < kMaxCapacity);
+
+ if constexpr (MPSC_DEBUG) {
+ fprintf(stderr,
+ "[%s] this=%p { mCapacity=%zu, mBits=%" PRIu64
+ ", mMask=0x%" PRIx64 " }\n",
+ __PRETTY_FUNCTION__, this, mCapacity, mBits, mMask);
+ }
+
+ // Leave one empty space in the queue, used to distinguish an empty queue
+ // from a full one, as in the SPSCQueue.
+ // https://docs.rs/signal-hook/0.3.17/src/signal_hook/low_level/channel.rs.html#126
+ for (uint64_t i = 1; i < StorageCapacity(); ++i) {
+ MarkSlot(mFree, i);
+ }
+
+ // This should be the only allocation performed, thus it cannot be performed
+ // in a restricted context (e.g., signal handler, real-time thread)
+ mData = std::make_unique<T[]>(Capacity());
+
+ std::atomic_thread_fence(std::memory_order_seq_cst);
+ }
+
+ /**
+ * @brief Put an element in the queue. The caller MUST check the return value
+ * and maybe loop to try again (or drop if acceptable).
+ *
+ * First it attempts to acuire a slot (storage index) that is known to be
+ * non used. If that is not successfull then 0 is returned. If that is
+ * successfull, the slot is ours (it has been exclusively acquired) and data
+ * can be copied into the ring buffer at that index.
+ *
+ * @param aElement The element to put in the queue.
+ *
+ * @return 0 if insertion could not be performed, inserted index otherwise
+ */
+ [[nodiscard]] int Send(T& aElement) {
+ std::optional<uint64_t> empty_idx = UnmarkSlot(mFree);
+ if (empty_idx.has_value()) {
+ detail::MemoryOperations<T>::MoveOrCopy(&mData[*empty_idx - 1], &aElement,
+ 1);
+ MarkSlot(mOccupied, *empty_idx);
+ return *empty_idx;
+ }
+ return 0;
+ }
+
+ /**
+ * Retrieve one element from the ring buffer, and copy it to
+ * `aElement`, if non-null.
+ *
+ * It attempts to acquire a slot from the list of used ones. If that is not
+ * successfull, then 0 is returned. Once a slot has been exclusively acquired,
+ * data is copied from it into the non-null pointer passed in parameter.
+ *
+ * @param aElement A pointer to a `T` where data will be copied.
+ *
+ * @return The index from which data was copied, 0 if there was nothing in the
+ * ring buffer.
+ */
+ [[nodiscard]] int Recv(T* aElement) {
+ std::optional<uint64_t> idx = UnmarkSlot(mOccupied);
+ if (idx.has_value()) {
+ if (aElement) {
+ detail::MemoryOperations<T>::MoveOrCopy(aElement, &mData[*idx - 1], 1);
+ }
+ MarkSlot(mFree, *idx);
+ return *idx;
+ }
+ return 0;
+ }
+
+ size_t Capacity() const { return StorageCapacity() - 1; }
+
+ private:
+ /*
+ * Get/Set manipulates the encoding within `aNumber` by storing the index as a
+ * number and shifting it to the left (set) or right (get).
+ *
+ * Initial `aNumber` value is 0.
+ *
+ * Set() with first index value (1), we store the index on mBits and we shift
+ * it to the left, e.g., as follows:
+ *
+ * aNumber=0b00000000000000000000000000000000000000000000000000000000000000
+ * aIndex=0 aValue=1
+ * aNumber=0b00000000000000000000000000000000000000000000000000000000000001
+ * aIndex=1 aValue=33
+ * aNumber=0b00000000000000000000000000000000000000000000000000000000100001
+ * aIndex=2 aValue=801
+ * aNumber=0b00000000000000000000000000000000000000000000000000001100100001
+ * aIndex=3 aValue=17185
+ * aNumber=0b00000000000000000000000000000000000000000000000100001100100001
+ * aIndex=4 aValue=344865
+ * aNumber=0b00000000000000000000000000000000000000000001010100001100100001
+ * aIndex=5 aValue=6636321
+ * aNumber=0b00000000000000000000000000000000000000011001010100001100100001
+ * aIndex=6 aValue=124076833
+ * aNumber=0b00000000000000000000000000000000000111011001010100001100100001
+ * aIndex=7 aValue=2271560481
+ * aNumber=0b00000000000000000000000000000010000111011001010100001100100001
+ * aIndex=8 aValue=40926266145
+ * aNumber=0b00000000000000000000000000100110000111011001010100001100100001
+ * aIndex=9 aValue=728121033505
+ * aNumber=0b00000000000000000000001010100110000111011001010100001100100001
+ * aIndex=10 aValue=12822748939041
+ * aNumber=0b00000000000000000010111010100110000111011001010100001100100001
+ * aIndex=11 aValue=223928981472033
+ * aNumber=0b00000000000000110010111010100110000111011001010100001100100001
+ * aIndex=12 aValue=3883103678710561
+ * aNumber=0b00000000001101110010111010100110000111011001010100001100100001
+ * aIndex=13 aValue=66933498461897505
+ * aNumber=0b00000011101101110010111010100110000111011001010100001100100001
+ * aIndex=14 aValue=1147797409030816545
+ */
+ [[nodiscard]] uint64_t Get(uint64_t aNumber, uint64_t aIndex) {
+ return (aNumber >> (mBits * aIndex)) & mMask;
+ }
+
+ [[nodiscard]] uint64_t Set(uint64_t aNumber, uint64_t aIndex,
+ uint64_t aValue) {
+ return (aNumber & ~(mMask << (mBits * aIndex))) |
+ (aValue << (mBits * aIndex));
+ }
+
+ /*
+ * Enqueue a value in the ring buffer at aIndex.
+ *
+ * Takes the current uint64_t value from the atomic and try to acquire a non
+ * used slot in the ring buffer. If unsucessfull, 0 is returned, otherwise
+ * compute the new atomic value that holds the new state of usage of the
+ * slots, and use compare/exchange to perform lock-free synchronization:
+ * compare/exchanges succeeds when the current value and the modified one are
+ * equal, reflecting an acquired lock. If another thread was concurrent to
+ * this one, then it would fail to that operation, and go into the next
+ * iteration of the loop to read the new state value from the atomic, and
+ * acquire a different slot.
+ *
+ * @param aSlotStatus a uint64_t atomic that is used to perform lock-free
+ * thread exclusions
+ *
+ * @param aIndex the index where we want to enqueue. It should come from the
+ * empty queue
+ * */
+ void MarkSlot(std::atomic<uint64_t>& aSlotStatus, uint64_t aIndex) {
+ uint64_t current = aSlotStatus.load(std::memory_order_relaxed);
+ do {
+ // Attempts to find a slot that is available to enqueue, without
+ // cross-thread synchronization
+ auto empty = [&]() -> std::optional<uint64_t> {
+ for (uint64_t i = 0; i < Capacity(); ++i) {
+ if (Get(current, i) == 0) {
+ return i;
+ }
+ }
+ return {};
+ }();
+ if (!empty.has_value()) {
+ // Rust does expect() which would panic:
+ // https://docs.rs/signal-hook/0.3.17/src/signal_hook/low_level/channel.rs.html#62
+ // If there's no empty place, then it would be up to the caller to deal
+ // with that
+ MOZ_CRASH("No empty slot available");
+ }
+ uint64_t modified = Set(current, *empty, aIndex);
+ // This is where the lock-free synchronization happens ; if `current`
+ // matches the content of `aSlotStatus`, then store `modified` in
+ // aSlotStatus and succeeds. Upon success it means no other thread has
+ // tried to change the same value at the same time, so the lock was safely
+ // acquired.
+ //
+ // Upon failure, it means another thread tried at the same time to use the
+ // same slot, so a new iteration of the loop needs to be executed to try
+ // another slot.
+ //
+ // In case of success (`aSlotStatus`'s content is equal to `current`), we
+ // require memory_order_release for the read-modify-write operation
+ // because we want to make sure when acquiring a slot that any concurrent
+ // thread performing a write had a chance to do it.
+ //
+ // In case of failure we require memory_order_relaxed for the load
+ // operation because we dont need synchronization at that point.
+ if (aSlotStatus.compare_exchange_weak(current, modified,
+ std::memory_order_release,
+ std::memory_order_relaxed)) {
+ if constexpr (MPSC_DEBUG) {
+ fprintf(stderr,
+ "[enqueue] modified=0x%" PRIx64 " => index=%" PRIu64 "\n",
+ modified, aIndex);
+ }
+ return;
+ }
+ } while (true);
+ }
+
+ /*
+ * Dequeue a value from the ring buffer.
+ *
+ * Takes the current value from the uint64_t atomic and read the current index
+ * out of it. If that index is 0 then we are facing a lack of slots and we
+ * return, the caller MUST check this and deal with the situation. If the
+ * index is non null we can try to acquire the matching slot in the ring
+ * buffer thanks to the compare/exchange loop. When the compare/exchange call
+ * succeeds, then the slot was acquired.
+ *
+ * @param aSlotStatus a uint64_t atomic that is used to perform lock-free
+ * thread exclusions
+ * */
+ [[nodiscard]] std::optional<uint64_t> UnmarkSlot(
+ std::atomic<uint64_t>& aSlotStatus) {
+ uint64_t current = aSlotStatus.load(std::memory_order_relaxed);
+ do {
+ uint64_t index = current & mMask;
+ if (index == 0) {
+ // Return a None
+ // https://docs.rs/signal-hook/0.3.17/src/signal_hook/low_level/channel.rs.html#77
+ // If we return None while dequeuing on mFree then we are full and the
+ // caller needs to deal with that.
+ return {};
+ }
+ uint64_t modified = current >> mBits;
+ // See the comment in MarkSlot for details
+ //
+ // In case of success (`aSlotStatus`'s content is equal to `current`), we
+ // require memory_order_acquire for the read-modify-write operation
+ // because we want to make sure when unmarking a slot that any concurrent
+ // thread performing a read will see the value we are writing.
+ //
+ // In case of failure we require memory_order_relaxed for the load
+ // operation because we dont need synchronization at that point.
+ if (aSlotStatus.compare_exchange_weak(current, modified,
+ std::memory_order_acquire,
+ std::memory_order_relaxed)) {
+ if constexpr (MPSC_DEBUG) {
+ fprintf(stderr,
+ "[dequeue] current=0x%" PRIx64 " => index=%" PRIu64 "\n",
+ current, index);
+ }
+ return index;
+ }
+ } while (true);
+ return {};
+ }
+
+ // Return the number of elements we can store within the ring buffer, whereas
+ // Capacity() will return the amount of elements in mData, including the 0
+ // value.
+ [[nodiscard]] size_t StorageCapacity() const { return mCapacity; }
+
+ // For the atomics below they are manipulated by Get()/Set(), and we are using
+ // them to store the IDs of the ring buffer usage (empty/full).
+ //
+ // We use mBits bits to store an ID (so we are limited to 16 and 0 is
+ // reserved) and append each of them to the atomics.
+ //
+ // A 0 value in one of those denotes we are full for the atomic, i.e.,
+ // mFree=0 means we are full and mOccupied=0 means we are empty.
+
+ // Holds the IDs of the free slots in the ring buffer
+ std::atomic<uint64_t> mFree;
+
+ // Holds the IDs of the occupied slots in the ring buffer
+ std::atomic<uint64_t> mOccupied;
+
+ const size_t mCapacity;
+
+ // The actual ring buffer
+ std::unique_ptr<T[]> mData;
+
+ // How we are using the uint64_t atomic above to store the IDs of the ring
+ // buffer.
+ static const uint64_t mBits = 4;
+ static const uint64_t mMask = 0b1111;
+};
+
+/**
+ * Instantiation of the `MPSCRingBufferBase` type. This is safe to use from
+ * several producers threads and one one consumer (that never changes role),
+ * without explicit synchronization nor allocation (outside of the constructor).
+ */
+template <typename T>
+using MPSCQueue = MPSCRingBufferBase<T>;
+
+} // namespace mozilla
+
+#endif // mozilla_MPSCQueue_h
diff --git a/mfbt/Result.h b/mfbt/Result.h
index 052920fdbf..fba5db25b9 100644
--- a/mfbt/Result.h
+++ b/mfbt/Result.h
@@ -834,6 +834,15 @@ class [[nodiscard]] Result final {
constexpr auto andThen(F f) -> std::invoke_result_t<F, V&&> {
return MOZ_LIKELY(isOk()) ? f(unwrap()) : propagateErr();
}
+
+ bool operator==(const Result<V, E>& aOther) const {
+ return (isOk() && aOther.isOk() && inspect() == aOther.inspect()) ||
+ (isErr() && aOther.isErr() && inspectErr() == aOther.inspectErr());
+ }
+
+ bool operator!=(const Result<V, E>& aOther) const {
+ return !(*this == aOther);
+ }
};
/**
diff --git a/mfbt/Span.h b/mfbt/Span.h
index d9ba1af220..ca754f3810 100644
--- a/mfbt/Span.h
+++ b/mfbt/Span.h
@@ -41,6 +41,9 @@ namespace mozilla {
template <typename T, size_t Length>
class Array;
+template <typename Enum, typename T, size_t Length>
+class EnumeratedArray;
+
// Stuff from gsl_util
// narrow_cast(): a searchable way to do narrowing casts of values
@@ -488,6 +491,23 @@ class Span {
: storage_(&aArr[0], span_details::extent_type<N>()) {}
/**
+ * Constructor for mozilla::EnumeratedArray.
+ */
+ template <size_t N, class Enum,
+ class ArrayElementType = std::remove_const_t<element_type>>
+ constexpr MOZ_IMPLICIT Span(
+ mozilla::EnumeratedArray<Enum, ArrayElementType, N>& aArr)
+ : storage_(&aArr[Enum(0)], span_details::extent_type<N>()) {}
+
+ /**
+ * Constructor for const mozilla::EnumeratedArray.
+ */
+ template <size_t N, class Enum>
+ constexpr MOZ_IMPLICIT Span(const mozilla::EnumeratedArray<
+ Enum, std::remove_const_t<element_type>, N>& aArr)
+ : storage_(&aArr[Enum(0)], span_details::extent_type<N>()) {}
+
+ /**
* Constructor for mozilla::UniquePtr holding an array and length.
*/
template <class ArrayElementType = std::add_pointer<element_type>,
@@ -852,6 +872,12 @@ Span(mozilla::Array<T, Extent>&) -> Span<T, Extent>;
template <typename T, size_t Extent>
Span(const mozilla::Array<T, Extent>&) -> Span<const T, Extent>;
+template <typename Enum, typename T, size_t Extent>
+Span(mozilla::EnumeratedArray<Enum, T, Extent>&) -> Span<T, Extent>;
+
+template <typename Enum, typename T, size_t Extent>
+Span(const mozilla::EnumeratedArray<Enum, T, Extent>&) -> Span<const T, Extent>;
+
// [Span.comparison], Span comparison operators
template <class ElementType, size_t FirstExtent, size_t SecondExtent>
inline constexpr bool operator==(const Span<ElementType, FirstExtent>& l,
diff --git a/mfbt/moz.build b/mfbt/moz.build
index 3a3ab46f71..c1f9a8f92a 100644
--- a/mfbt/moz.build
+++ b/mfbt/moz.build
@@ -73,6 +73,7 @@ EXPORTS.mozilla = [
"MemoryChecking.h",
"MemoryReporting.h",
"MoveOnlyFunction.h",
+ "MPSCQueue.h",
"MruCache.h",
"NeverDestroyed.h",
"NonDereferenceable.h",
diff --git a/mfbt/tests/TestAtomicBitfields.cpp b/mfbt/tests/TestAtomicBitfields.cpp
index 237dbde538..9f561c6b7b 100644
--- a/mfbt/tests/TestAtomicBitfields.cpp
+++ b/mfbt/tests/TestAtomicBitfields.cpp
@@ -65,12 +65,12 @@ void TestDocumentationExample() {
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, \
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32))
-#define CHECK_BOOL(aIndex) \
- MOZ_ASSERT(val.LoadFlag##aIndex() == false); \
- val.StoreFlag##aIndex(true); \
- MOZ_ASSERT(val.LoadFlag##aIndex() == true); \
- val.StoreFlag##aIndex(false); \
- MOZ_ASSERT(val.LoadFlag##aIndex() == false);
+#define CHECK_BOOL(aIndex) \
+ MOZ_RELEASE_ASSERT(val.LoadFlag##aIndex() == false); \
+ val.StoreFlag##aIndex(true); \
+ MOZ_RELEASE_ASSERT(val.LoadFlag##aIndex() == true); \
+ val.StoreFlag##aIndex(false); \
+ MOZ_RELEASE_ASSERT(val.LoadFlag##aIndex() == false);
#define GENERATE_TEST_JAMMED_WITH_FLAGS(aSize) \
void TestJammedWithFlags##aSize() { \
@@ -82,31 +82,31 @@ void TestDocumentationExample() {
// ========================= TestLopsided ===========================
-#define GENERATE_TEST_LOPSIDED_FUNC(aSide, aSize) \
- void TestLopsided##aSide##aSize() { \
- Lopsided##aSide##aSize val; \
- MOZ_ASSERT(val.LoadHappyLittleBit() == false); \
- MOZ_ASSERT(val.LoadLargeAndInCharge() == 0); \
- val.StoreHappyLittleBit(true); \
- MOZ_ASSERT(val.LoadHappyLittleBit() == true); \
- MOZ_ASSERT(val.LoadLargeAndInCharge() == 0); \
- val.StoreLargeAndInCharge(1); \
- MOZ_ASSERT(val.LoadHappyLittleBit() == true); \
- MOZ_ASSERT(val.LoadLargeAndInCharge() == 1); \
- val.StoreLargeAndInCharge(0); \
- MOZ_ASSERT(val.LoadHappyLittleBit() == true); \
- MOZ_ASSERT(val.LoadLargeAndInCharge() == 0); \
- uint##aSize##_t size = aSize; \
- uint##aSize##_t int_max = (~(1ull << (size - 1))) - 1; \
- val.StoreLargeAndInCharge(int_max); \
- MOZ_ASSERT(val.LoadHappyLittleBit() == true); \
- MOZ_ASSERT(val.LoadLargeAndInCharge() == int_max); \
- val.StoreHappyLittleBit(false); \
- MOZ_ASSERT(val.LoadHappyLittleBit() == false); \
- MOZ_ASSERT(val.LoadLargeAndInCharge() == int_max); \
- val.StoreLargeAndInCharge(int_max); \
- MOZ_ASSERT(val.LoadHappyLittleBit() == false); \
- MOZ_ASSERT(val.LoadLargeAndInCharge() == int_max); \
+#define GENERATE_TEST_LOPSIDED_FUNC(aSide, aSize) \
+ void TestLopsided##aSide##aSize() { \
+ Lopsided##aSide##aSize val; \
+ MOZ_RELEASE_ASSERT(val.LoadHappyLittleBit() == false); \
+ MOZ_RELEASE_ASSERT(val.LoadLargeAndInCharge() == 0); \
+ val.StoreHappyLittleBit(true); \
+ MOZ_RELEASE_ASSERT(val.LoadHappyLittleBit() == true); \
+ MOZ_RELEASE_ASSERT(val.LoadLargeAndInCharge() == 0); \
+ val.StoreLargeAndInCharge(1); \
+ MOZ_RELEASE_ASSERT(val.LoadHappyLittleBit() == true); \
+ MOZ_RELEASE_ASSERT(val.LoadLargeAndInCharge() == 1); \
+ val.StoreLargeAndInCharge(0); \
+ MOZ_RELEASE_ASSERT(val.LoadHappyLittleBit() == true); \
+ MOZ_RELEASE_ASSERT(val.LoadLargeAndInCharge() == 0); \
+ uint##aSize##_t size = aSize; \
+ uint##aSize##_t int_max = (~(1ull << (size - 1))) - 1; \
+ val.StoreLargeAndInCharge(int_max); \
+ MOZ_RELEASE_ASSERT(val.LoadHappyLittleBit() == true); \
+ MOZ_RELEASE_ASSERT(val.LoadLargeAndInCharge() == int_max); \
+ val.StoreHappyLittleBit(false); \
+ MOZ_RELEASE_ASSERT(val.LoadHappyLittleBit() == false); \
+ MOZ_RELEASE_ASSERT(val.LoadLargeAndInCharge() == int_max); \
+ val.StoreLargeAndInCharge(int_max); \
+ MOZ_RELEASE_ASSERT(val.LoadHappyLittleBit() == false); \
+ MOZ_RELEASE_ASSERT(val.LoadLargeAndInCharge() == int_max); \
}
#define GENERATE_TEST_LOPSIDED(aSize) \
diff --git a/mfbt/tests/TestEnumTypeTraits.cpp b/mfbt/tests/TestEnumTypeTraits.cpp
index 1065c92a7b..67c6000234 100644
--- a/mfbt/tests/TestEnumTypeTraits.cpp
+++ b/mfbt/tests/TestEnumTypeTraits.cpp
@@ -134,7 +134,7 @@ void TestFitForTypes() {
template <typename T, typename U>
static constexpr void AssertSameTypeAndValue(T a, U b) {
static_assert(std::is_same_v<T, U>);
- MOZ_ASSERT(a == b);
+ MOZ_RELEASE_ASSERT(a == b);
}
void TestUnderlyingValue() {
diff --git a/mfbt/tests/TestFloatingPoint.cpp b/mfbt/tests/TestFloatingPoint.cpp
index 44918cd1c5..fa76e59310 100644
--- a/mfbt/tests/TestFloatingPoint.cpp
+++ b/mfbt/tests/TestFloatingPoint.cpp
@@ -267,15 +267,15 @@ template <typename T>
static void TestEqualsIsForInt32(T aVal) {
int32_t i32;
A(NumberIsInt32(aVal, &i32));
- MOZ_ASSERT(i32 == aVal);
+ MOZ_RELEASE_ASSERT(i32 == aVal);
A(NumberEqualsInt32(aVal, &i32));
- MOZ_ASSERT(i32 == aVal);
+ MOZ_RELEASE_ASSERT(i32 == aVal);
int64_t i64;
A(NumberIsInt64(aVal, &i64));
- MOZ_ASSERT(i64 == aVal);
+ MOZ_RELEASE_ASSERT(i64 == aVal);
A(NumberEqualsInt64(aVal, &i64));
- MOZ_ASSERT(i64 == aVal);
+ MOZ_RELEASE_ASSERT(i64 == aVal);
};
// Used to test Number{Is,Equals}{Int32,Int64} for values that fit in int64 but
@@ -288,9 +288,9 @@ static void TestEqualsIsForInt64(T aVal) {
int64_t i64;
A(NumberIsInt64(aVal, &i64));
- MOZ_ASSERT(i64 == aVal);
+ MOZ_RELEASE_ASSERT(i64 == aVal);
A(NumberEqualsInt64(aVal, &i64));
- MOZ_ASSERT(i64 == aVal);
+ MOZ_RELEASE_ASSERT(i64 == aVal);
};
// Used to test Number{Is,Equals}{Int32,Int64} for values that aren't equal to
diff --git a/mfbt/tests/TestMPSCQueue.cpp b/mfbt/tests/TestMPSCQueue.cpp
new file mode 100644
index 0000000000..6ad668d115
--- /dev/null
+++ b/mfbt/tests/TestMPSCQueue.cpp
@@ -0,0 +1,169 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "mozilla/MPSCQueue.h"
+#include "mozilla/PodOperations.h"
+#include <vector>
+#include <iostream>
+#include <thread>
+#include <chrono>
+#include <memory>
+#include <string>
+
+using namespace mozilla;
+
+struct NativeStack {
+ void* mPCs[32];
+ void* mSPs[32];
+ size_t mCount;
+ size_t mTid;
+};
+
+void StackWalkCallback(void* aPC, void* aSP, NativeStack* nativeStack) {
+ nativeStack->mSPs[nativeStack->mCount] = aSP;
+ nativeStack->mPCs[nativeStack->mCount] = aPC;
+ nativeStack->mCount++;
+}
+
+void FillNativeStack(NativeStack* aStack) {
+ StackWalkCallback((void*)0x1234, (void*)0x9876, aStack);
+ StackWalkCallback((void*)0x3456, (void*)0x5432, aStack);
+ StackWalkCallback((void*)0x7890, (void*)0x1098, aStack);
+ StackWalkCallback((void*)0x1234, (void*)0x7654, aStack);
+ StackWalkCallback((void*)0x5678, (void*)0x3210, aStack);
+ StackWalkCallback((void*)0x9012, (void*)0x9876, aStack);
+ StackWalkCallback((void*)0x1334, (void*)0x9786, aStack);
+ StackWalkCallback((void*)0x3546, (void*)0x5342, aStack);
+ StackWalkCallback((void*)0x7809, (void*)0x0198, aStack);
+ StackWalkCallback((void*)0x4123, (void*)0x7645, aStack);
+ StackWalkCallback((void*)0x5768, (void*)0x3120, aStack);
+ StackWalkCallback((void*)0x9102, (void*)0x9867, aStack);
+ StackWalkCallback((void*)0x1243, (void*)0x8976, aStack);
+ StackWalkCallback((void*)0x6345, (void*)0x4325, aStack);
+ StackWalkCallback((void*)0x8790, (void*)0x1908, aStack);
+ StackWalkCallback((void*)0x134, (void*)0x654, aStack);
+ StackWalkCallback((void*)0x567, (void*)0x320, aStack);
+ StackWalkCallback((void*)0x901, (void*)0x976, aStack);
+}
+
+void BasicAPITestWithStack(MPSCQueue<NativeStack>& aQueue, size_t aCap) {
+ MOZ_RELEASE_ASSERT(aQueue.Capacity() == aCap);
+
+ NativeStack s = {.mCount = 0};
+ FillNativeStack(&s);
+ MOZ_RELEASE_ASSERT(s.mCount == 18);
+
+ int store = -1;
+ for (size_t i = 0; i < aCap; ++i) {
+ store = aQueue.Send(s);
+ MOZ_RELEASE_ASSERT(store > 0);
+ }
+
+ int retrieve = -1;
+ for (size_t i = 0; i < aCap; ++i) {
+ NativeStack sr{};
+ retrieve = aQueue.Recv(&sr);
+
+ MOZ_RELEASE_ASSERT(retrieve > 0);
+ MOZ_RELEASE_ASSERT(&s != &sr);
+ MOZ_RELEASE_ASSERT(s.mCount == sr.mCount);
+
+ for (size_t i = 0; i < s.mCount; ++i) {
+ MOZ_RELEASE_ASSERT(s.mPCs[i] == sr.mPCs[i]);
+ MOZ_RELEASE_ASSERT(s.mSPs[i] == sr.mSPs[i]);
+ }
+ }
+}
+
+void BasicAPITestMP(MPSCQueue<NativeStack>& aQueue, size_t aThreads) {
+ MOZ_RELEASE_ASSERT(aQueue.Capacity() == 15);
+
+ std::thread consumer([&aQueue, aThreads] {
+ size_t received = 0;
+ NativeStack v{};
+ do {
+ int deq = aQueue.Recv(&v);
+ if (deq > 0) {
+ received++;
+ }
+ std::this_thread::sleep_for(std::chrono::microseconds(10));
+ } while (received < aThreads);
+ });
+
+ std::thread producers[aThreads];
+ for (size_t t = 0; t < aThreads; ++t) {
+ producers[t] = std::thread([&aQueue, t] {
+ NativeStack s = {.mCount = 0, .mTid = t};
+ FillNativeStack(&s);
+ MOZ_RELEASE_ASSERT(s.mCount == 18);
+
+ int sent = 0;
+ // wrap in a do { } while () because Send() will return 0 on message being
+ // dropped so we want to retry
+ do {
+ std::this_thread::sleep_for(std::chrono::microseconds(5));
+ sent = aQueue.Send(s);
+ } while (sent == 0);
+ });
+ }
+
+ for (size_t t = 0; t < aThreads; ++t) {
+ producers[t].join();
+ }
+ consumer.join();
+}
+
+int main() {
+ size_t caps[] = {2, 5, 7, 10, 15};
+ for (auto maxCap : caps) {
+ MPSCQueue<NativeStack> s(maxCap);
+ BasicAPITestWithStack(s, maxCap);
+ }
+
+ {
+ NativeStack e{};
+ MPSCQueue<NativeStack> deq(2);
+
+ // Dequeue with nothing should return 0 and not fail later
+ int retrieve = deq.Recv(&e);
+ MOZ_RELEASE_ASSERT(retrieve == 0);
+
+ NativeStack real = {.mCount = 0};
+ FillNativeStack(&real);
+ MOZ_RELEASE_ASSERT(real.mCount == 18);
+
+ int store = deq.Send(real);
+ MOZ_RELEASE_ASSERT(store > 0);
+ store = deq.Send(real);
+ MOZ_RELEASE_ASSERT(store > 0);
+
+ // should be full we should get 0
+ store = deq.Send(real);
+ MOZ_RELEASE_ASSERT(store == 0);
+
+ // try to dequeue
+ NativeStack e1{};
+ retrieve = deq.Recv(&e1);
+ MOZ_RELEASE_ASSERT(retrieve > 0);
+ MOZ_RELEASE_ASSERT(e1.mCount == 18);
+
+ NativeStack e2{};
+ retrieve = deq.Recv(&e2);
+ MOZ_RELEASE_ASSERT(retrieve > 0);
+ MOZ_RELEASE_ASSERT(e2.mCount == 18);
+
+ retrieve = deq.Recv(&e);
+ MOZ_RELEASE_ASSERT(retrieve == 0);
+ }
+
+ size_t nbThreads[] = {8, 16, 64, 128, 512, 1024};
+ for (auto threads : nbThreads) {
+ MPSCQueue<NativeStack> s(15);
+ BasicAPITestMP(s, threads);
+ }
+
+ return 0;
+}
diff --git a/mfbt/tests/TestMathAlgorithms.cpp b/mfbt/tests/TestMathAlgorithms.cpp
index a21b286d0f..f17454041f 100644
--- a/mfbt/tests/TestMathAlgorithms.cpp
+++ b/mfbt/tests/TestMathAlgorithms.cpp
@@ -96,7 +96,7 @@ static void TestIsPowerOfTwo() {
}
void TestGCD() {
- MOZ_ASSERT(mozilla::GCD(0, 0) == 0);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(0, 0) == 0);
// clang-format off
// import random
@@ -118,7 +118,7 @@ void TestGCD() {
// res = math.gcd(a, b)
// j+=1
// suffix = case["suffix"]
- // print(f'MOZ_ASSERT(mozilla::GCD({a}{suffix}, {b}{suffix}) == {res}{suffix});')
+ // print(f'MOZ_RELEASE_ASSERT(mozilla::GCD({a}{suffix}, {b}{suffix}) == {res}{suffix});')
// if j == 100:
// j = 0
// break
@@ -126,414 +126,606 @@ void TestGCD() {
// clang-format on
// signed 64-bits integers
- MOZ_ASSERT(mozilla::GCD(6855423437784447881, 5744152981668854128) == 1);
- MOZ_ASSERT(mozilla::GCD(2560787397587345465, 208780102238346432) == 1);
- MOZ_ASSERT(mozilla::GCD(5577889716064657494, 2159469434101077254) == 2);
- MOZ_ASSERT(mozilla::GCD(5349904765384950054, 1944688623103480392) == 18);
- MOZ_ASSERT(mozilla::GCD(6510887230309733540, 4404045615056449988) == 4);
- MOZ_ASSERT(mozilla::GCD(5153663464686238190, 3495293373406661950) == 10);
- MOZ_ASSERT(mozilla::GCD(8640438456651239176, 6172550763106125918) == 2);
- MOZ_ASSERT(mozilla::GCD(4636330475123995525, 2504439215041170117) == 1);
- MOZ_ASSERT(mozilla::GCD(3049680828923698889, 1798896016456058960) == 1);
- MOZ_ASSERT(mozilla::GCD(6857469018143857254, 839235513850919013) == 3);
- MOZ_ASSERT(mozilla::GCD(1667993323500460751, 403448480939209779) == 1);
- MOZ_ASSERT(mozilla::GCD(2756773685517793960, 1001994517356200529) == 1);
- MOZ_ASSERT(mozilla::GCD(5809484314452898314, 252378426271103138) == 2);
- MOZ_ASSERT(mozilla::GCD(5756566734144094840, 3050839541929564330) == 10);
- MOZ_ASSERT(mozilla::GCD(2669472117169059649, 1053394704248223342) == 1);
- MOZ_ASSERT(mozilla::GCD(8486335744011214524, 4866724521619209633) == 3);
- MOZ_ASSERT(mozilla::GCD(4841597191067437171, 1862876789330567260) == 1);
- MOZ_ASSERT(mozilla::GCD(8940692064089049746, 6136664682975600685) == 1);
- MOZ_ASSERT(mozilla::GCD(6274111242168941448, 688426762929457484) == 4);
- MOZ_ASSERT(mozilla::GCD(7715132980994738435, 1456592620536615117) == 1);
- MOZ_ASSERT(mozilla::GCD(5650339953233205545, 4406664870835551648) == 1);
- MOZ_ASSERT(mozilla::GCD(7763657864638523008, 306878184260935929) == 1);
- MOZ_ASSERT(mozilla::GCD(7776062097319502113, 7551650059636008893) == 1);
- MOZ_ASSERT(mozilla::GCD(9158681410218029314, 5401644381866109508) == 2);
- MOZ_ASSERT(mozilla::GCD(428865066965126615, 345306139889243757) == 1);
- MOZ_ASSERT(mozilla::GCD(1334408785926182232, 736025095410140597) == 1);
- MOZ_ASSERT(mozilla::GCD(9129011607893106326, 4818080883860535758) == 2);
- MOZ_ASSERT(mozilla::GCD(5968300398911311896, 2550670869539540947) == 1);
- MOZ_ASSERT(mozilla::GCD(5030190181362172874, 3861860193070954804) == 2);
- MOZ_ASSERT(mozilla::GCD(5449912203994605772, 395450435226244945) == 1);
- MOZ_ASSERT(mozilla::GCD(3510149608312823296, 1122015596295686144) == 512);
- MOZ_ASSERT(mozilla::GCD(8822408923914428398, 3005499570530356734) == 2);
- MOZ_ASSERT(mozilla::GCD(1894251920744324374, 29251650223056432) == 2);
- MOZ_ASSERT(mozilla::GCD(1643262375132697825, 133049278064101269) == 1);
- MOZ_ASSERT(mozilla::GCD(5979771268022611030, 5021008984454830630) == 10);
- MOZ_ASSERT(mozilla::GCD(8551631013482492569, 3214028471848344275) == 1);
- MOZ_ASSERT(mozilla::GCD(1374240599294724199, 1106817149419837791) == 1);
- MOZ_ASSERT(mozilla::GCD(7877493197090616258, 3627451313613172281) == 3);
- MOZ_ASSERT(mozilla::GCD(7323120572203017429, 5958183356236253053) == 1);
- MOZ_ASSERT(mozilla::GCD(7356702947943126364, 1234023498733740170) == 2);
- MOZ_ASSERT(mozilla::GCD(3533663535984312691, 1287666490057924782) == 1);
- MOZ_ASSERT(mozilla::GCD(8249625410612436788, 1692674983510387167) == 1);
- MOZ_ASSERT(mozilla::GCD(6590544882911640025, 6518468963976945930) == 5);
- MOZ_ASSERT(mozilla::GCD(1161703442901270391, 72640111759506406) == 1);
- MOZ_ASSERT(mozilla::GCD(3648054318401558456, 286110734809583843) == 1);
- MOZ_ASSERT(mozilla::GCD(7445158880116265073, 4921289272987608741) == 3);
- MOZ_ASSERT(mozilla::GCD(8052135113655284875, 6319225376882653323) == 1);
- MOZ_ASSERT(mozilla::GCD(1272523803145322419, 669368693174176828) == 1);
- MOZ_ASSERT(mozilla::GCD(762600464449954636, 258101161586809942) == 2);
- MOZ_ASSERT(mozilla::GCD(8711570456095175409, 3217102356729157526) == 1);
- MOZ_ASSERT(mozilla::GCD(8596472485422071677, 6590296624757765441) == 1);
- MOZ_ASSERT(mozilla::GCD(8830210169177656300, 4853400012200083924) == 4);
- MOZ_ASSERT(mozilla::GCD(2241405940749418043, 1414859858059940275) == 1);
- MOZ_ASSERT(mozilla::GCD(6645372226653882826, 1089866326575332751) == 1);
- MOZ_ASSERT(mozilla::GCD(4972052091595687646, 3420503469411720440) == 2);
- MOZ_ASSERT(mozilla::GCD(8796611232338780872, 8344997795629414169) == 1);
- MOZ_ASSERT(mozilla::GCD(4109837086789844244, 2749395249398063222) == 2);
- MOZ_ASSERT(mozilla::GCD(7099065868279436275, 3485530390566515044) == 1);
- MOZ_ASSERT(mozilla::GCD(1041731907675308955, 561481363772326233) == 9);
- MOZ_ASSERT(mozilla::GCD(5882271298652803063, 5189002859026699540) == 1);
- MOZ_ASSERT(mozilla::GCD(835073783923421192, 56853706366082462) == 2);
- MOZ_ASSERT(mozilla::GCD(2514946180207195049, 1934146334993787393) == 1);
- MOZ_ASSERT(mozilla::GCD(8975439209128912747, 1377234541321015082) == 1);
- MOZ_ASSERT(mozilla::GCD(7039355952603350033, 6501349986472883135) == 1);
- MOZ_ASSERT(mozilla::GCD(3747474677542899887, 2583298074596991574) == 1);
- MOZ_ASSERT(mozilla::GCD(8176323250144977780, 4706420973964948943) == 1);
- MOZ_ASSERT(mozilla::GCD(8748260715055109420, 7094433080013425893) == 1);
- MOZ_ASSERT(mozilla::GCD(2192085035443314042, 1964458338792492837) == 3);
- MOZ_ASSERT(mozilla::GCD(4387059045133366080, 1521989527531982075) == 5);
- MOZ_ASSERT(mozilla::GCD(5735277355594712161, 1564786041102368131) == 1);
- MOZ_ASSERT(mozilla::GCD(3898210686025675418, 1252531932064281967) == 7);
- MOZ_ASSERT(mozilla::GCD(1886253648955280570, 235795900409586307) == 7);
- MOZ_ASSERT(mozilla::GCD(862214669576776425, 90702464427080315) == 5);
- MOZ_ASSERT(mozilla::GCD(2831206027654482398, 2543050780384667441) == 1);
- MOZ_ASSERT(mozilla::GCD(3561377609788845927, 2837335262531584639) == 1);
- MOZ_ASSERT(mozilla::GCD(1973347825404473626, 634138253455209313) == 1);
- MOZ_ASSERT(mozilla::GCD(6447708134022060248, 4346890077474767787) == 19);
- MOZ_ASSERT(mozilla::GCD(1690365172062143048, 678324119874104971) == 1);
- MOZ_ASSERT(mozilla::GCD(2900650911116509049, 818833306053988358) == 1);
- MOZ_ASSERT(mozilla::GCD(4126258648185074937, 2190040072639642009) == 1);
- MOZ_ASSERT(mozilla::GCD(7310083765892765377, 3615506256861011852) == 1);
- MOZ_ASSERT(mozilla::GCD(1482494462925181129, 568665115985247457) == 1);
- MOZ_ASSERT(mozilla::GCD(2675477464881771327, 1476381757716745502) == 1);
- MOZ_ASSERT(mozilla::GCD(6437060864565620566, 266707802567839796) == 2);
- MOZ_ASSERT(mozilla::GCD(3800292251587454230, 245022706279648741) == 1);
- MOZ_ASSERT(mozilla::GCD(3549515343757259493, 1328377263505490456) == 1);
- MOZ_ASSERT(mozilla::GCD(8324574140787708570, 393444007055415700) == 10);
- MOZ_ASSERT(mozilla::GCD(4373054321374923750, 1031193918836627100) == 150);
- MOZ_ASSERT(mozilla::GCD(1370218692062991327, 682070501541164452) == 1);
- MOZ_ASSERT(mozilla::GCD(4728813669404513421, 2346998232227619529) == 1);
- MOZ_ASSERT(mozilla::GCD(320864023853706984, 50178854177191437) == 3);
- MOZ_ASSERT(mozilla::GCD(5424710852893793602, 4237974770221703674) == 2);
- MOZ_ASSERT(mozilla::GCD(5167582806125634015, 3538730725111557853) == 79);
- MOZ_ASSERT(mozilla::GCD(7197930858946883500, 6668556859540800605) == 5);
- MOZ_ASSERT(mozilla::GCD(2900089593575477549, 2554913303396097824) == 1);
- MOZ_ASSERT(mozilla::GCD(1397576820519717048, 847997331257829237) == 3);
- MOZ_ASSERT(mozilla::GCD(3939714364354053162, 1374067007308181723) == 1);
- MOZ_ASSERT(mozilla::GCD(1065626084531260890, 664198963621954813) == 317);
- MOZ_ASSERT(mozilla::GCD(5912876357514418196, 5112700044139286313) == 1);
- MOZ_ASSERT(mozilla::GCD(2654316726913809362, 588030922713986903) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(6855423437784447881, 5744152981668854128) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2560787397587345465, 208780102238346432) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(5577889716064657494, 2159469434101077254) ==
+ 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(5349904765384950054, 1944688623103480392) ==
+ 18);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(6510887230309733540, 4404045615056449988) ==
+ 4);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(5153663464686238190, 3495293373406661950) ==
+ 10);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(8640438456651239176, 6172550763106125918) ==
+ 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(4636330475123995525, 2504439215041170117) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3049680828923698889, 1798896016456058960) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(6857469018143857254, 839235513850919013) ==
+ 3);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1667993323500460751, 403448480939209779) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2756773685517793960, 1001994517356200529) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(5809484314452898314, 252378426271103138) ==
+ 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(5756566734144094840, 3050839541929564330) ==
+ 10);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2669472117169059649, 1053394704248223342) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(8486335744011214524, 4866724521619209633) ==
+ 3);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(4841597191067437171, 1862876789330567260) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(8940692064089049746, 6136664682975600685) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(6274111242168941448, 688426762929457484) ==
+ 4);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(7715132980994738435, 1456592620536615117) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(5650339953233205545, 4406664870835551648) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(7763657864638523008, 306878184260935929) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(7776062097319502113, 7551650059636008893) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(9158681410218029314, 5401644381866109508) ==
+ 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(428865066965126615, 345306139889243757) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1334408785926182232, 736025095410140597) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(9129011607893106326, 4818080883860535758) ==
+ 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(5968300398911311896, 2550670869539540947) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(5030190181362172874, 3861860193070954804) ==
+ 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(5449912203994605772, 395450435226244945) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3510149608312823296, 1122015596295686144) ==
+ 512);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(8822408923914428398, 3005499570530356734) ==
+ 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1894251920744324374, 29251650223056432) == 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1643262375132697825, 133049278064101269) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(5979771268022611030, 5021008984454830630) ==
+ 10);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(8551631013482492569, 3214028471848344275) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1374240599294724199, 1106817149419837791) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(7877493197090616258, 3627451313613172281) ==
+ 3);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(7323120572203017429, 5958183356236253053) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(7356702947943126364, 1234023498733740170) ==
+ 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3533663535984312691, 1287666490057924782) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(8249625410612436788, 1692674983510387167) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(6590544882911640025, 6518468963976945930) ==
+ 5);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1161703442901270391, 72640111759506406) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3648054318401558456, 286110734809583843) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(7445158880116265073, 4921289272987608741) ==
+ 3);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(8052135113655284875, 6319225376882653323) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1272523803145322419, 669368693174176828) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(762600464449954636, 258101161586809942) == 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(8711570456095175409, 3217102356729157526) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(8596472485422071677, 6590296624757765441) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(8830210169177656300, 4853400012200083924) ==
+ 4);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2241405940749418043, 1414859858059940275) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(6645372226653882826, 1089866326575332751) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(4972052091595687646, 3420503469411720440) ==
+ 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(8796611232338780872, 8344997795629414169) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(4109837086789844244, 2749395249398063222) ==
+ 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(7099065868279436275, 3485530390566515044) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1041731907675308955, 561481363772326233) ==
+ 9);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(5882271298652803063, 5189002859026699540) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(835073783923421192, 56853706366082462) == 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2514946180207195049, 1934146334993787393) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(8975439209128912747, 1377234541321015082) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(7039355952603350033, 6501349986472883135) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3747474677542899887, 2583298074596991574) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(8176323250144977780, 4706420973964948943) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(8748260715055109420, 7094433080013425893) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2192085035443314042, 1964458338792492837) ==
+ 3);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(4387059045133366080, 1521989527531982075) ==
+ 5);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(5735277355594712161, 1564786041102368131) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3898210686025675418, 1252531932064281967) ==
+ 7);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1886253648955280570, 235795900409586307) ==
+ 7);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(862214669576776425, 90702464427080315) == 5);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2831206027654482398, 2543050780384667441) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3561377609788845927, 2837335262531584639) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1973347825404473626, 634138253455209313) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(6447708134022060248, 4346890077474767787) ==
+ 19);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1690365172062143048, 678324119874104971) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2900650911116509049, 818833306053988358) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(4126258648185074937, 2190040072639642009) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(7310083765892765377, 3615506256861011852) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1482494462925181129, 568665115985247457) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2675477464881771327, 1476381757716745502) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(6437060864565620566, 266707802567839796) ==
+ 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3800292251587454230, 245022706279648741) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3549515343757259493, 1328377263505490456) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(8324574140787708570, 393444007055415700) ==
+ 10);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(4373054321374923750, 1031193918836627100) ==
+ 150);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1370218692062991327, 682070501541164452) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(4728813669404513421, 2346998232227619529) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(320864023853706984, 50178854177191437) == 3);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(5424710852893793602, 4237974770221703674) ==
+ 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(5167582806125634015, 3538730725111557853) ==
+ 79);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(7197930858946883500, 6668556859540800605) ==
+ 5);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2900089593575477549, 2554913303396097824) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1397576820519717048, 847997331257829237) ==
+ 3);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3939714364354053162, 1374067007308181723) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1065626084531260890, 664198963621954813) ==
+ 317);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(5912876357514418196, 5112700044139286313) ==
+ 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2654316726913809362, 588030922713986903) ==
+ 1);
// unsigned 64-bits integers
- MOZ_ASSERT(mozilla::GCD(16747832015348854198u, 10986175599217457242u) == 2u);
- MOZ_ASSERT(mozilla::GCD(14011882763672869646u, 1150181481133900726u) == 2u);
- MOZ_ASSERT(mozilla::GCD(6605029198216299492u, 2540177763690679863u) == 3u);
- MOZ_ASSERT(mozilla::GCD(8723446333453359635u, 5501999887069319528u) == 1u);
- MOZ_ASSERT(mozilla::GCD(2056609692029140361u, 1456692183174011231u) == 1u);
- MOZ_ASSERT(mozilla::GCD(3979920159703007405u, 2102351633956912159u) == 1u);
- MOZ_ASSERT(mozilla::GCD(9463892761763926474u, 5727651032816755587u) == 1u);
- MOZ_ASSERT(mozilla::GCD(15074653294321365395u, 7500084005319994862u) == 1u);
- MOZ_ASSERT(mozilla::GCD(7596876989397200146u, 2100623677138635163u) == 1u);
- MOZ_ASSERT(mozilla::GCD(15788975435035111366u, 13949507094186899135u) == 1u);
- MOZ_ASSERT(mozilla::GCD(11511089994271140687u, 11202842908571961185u) == 1u);
- MOZ_ASSERT(mozilla::GCD(5238481506779057035u, 1275096406977139452u) == 1u);
- MOZ_ASSERT(mozilla::GCD(10319988989820236521u, 6004256112028859859u) == 1u);
- MOZ_ASSERT(mozilla::GCD(15363016657999062582u, 13709656670722381934u) == 2u);
- MOZ_ASSERT(mozilla::GCD(1212882338768103987u, 400304873392680016u) == 1u);
- MOZ_ASSERT(mozilla::GCD(14516701884936382582u, 9474965125574306885u) == 1u);
- MOZ_ASSERT(mozilla::GCD(4684990176797036518u, 2826010316418750908u) == 2u);
- MOZ_ASSERT(mozilla::GCD(1257550743165743081u, 501524040422212694u) == 1u);
- MOZ_ASSERT(mozilla::GCD(2684107647237574540u, 1059404913392538915u) == 5u);
- MOZ_ASSERT(mozilla::GCD(9075798209725656040u, 8460431147770771484u) == 4u);
- MOZ_ASSERT(mozilla::GCD(8849414266308239550u, 2100344973594953676u) == 6u);
- MOZ_ASSERT(mozilla::GCD(18235452615524492166u, 6948238589518088517u) == 3u);
- MOZ_ASSERT(mozilla::GCD(15050298436941428700u, 1467533438133155187u) == 3u);
- MOZ_ASSERT(mozilla::GCD(8834598722016252963u, 4311275747815972852u) == 17u);
- MOZ_ASSERT(mozilla::GCD(9356558625132137133u, 2037947968328350721u) == 1u);
- MOZ_ASSERT(mozilla::GCD(3849613153563955590u, 742698742609310596u) == 2u);
- MOZ_ASSERT(mozilla::GCD(14456988562990139501u, 10112205238651656021u) == 1u);
- MOZ_ASSERT(mozilla::GCD(12307508681986233124u, 9812326358082292497u) == 1u);
- MOZ_ASSERT(mozilla::GCD(1542509761845906606u, 753342053499303952u) == 2u);
- MOZ_ASSERT(mozilla::GCD(3002452874498902380u, 1551203246991573851u) == 1u);
- MOZ_ASSERT(mozilla::GCD(6995746439795805457u, 1188069610619158471u) == 1u);
- MOZ_ASSERT(mozilla::GCD(2746395460341933223u, 2567350813567392270u) == 1u);
- MOZ_ASSERT(mozilla::GCD(13780256804547757349u, 3248441336598733689u) == 1u);
- MOZ_ASSERT(mozilla::GCD(11585262422698980788u, 9223319679416307971u) == 1u);
- MOZ_ASSERT(mozilla::GCD(12061506913736835258u, 4388981418731026638u) == 54u);
- MOZ_ASSERT(mozilla::GCD(7926097431519628264u, 6609465824726553267u) == 1u);
- MOZ_ASSERT(mozilla::GCD(4869073093357623730u, 127092341961569309u) == 1u);
- MOZ_ASSERT(mozilla::GCD(2415749375652736599u, 1225333195065764619u) == 3u);
- MOZ_ASSERT(mozilla::GCD(12396258519293261927u, 7854932518032305093u) == 1u);
- MOZ_ASSERT(mozilla::GCD(8482841866529133449u, 8041279973223483861u) == 1u);
- MOZ_ASSERT(mozilla::GCD(6256232276718808317u, 218093546248209886u) == 1u);
- MOZ_ASSERT(mozilla::GCD(8708964372422992556u, 5925839455605803265u) == 1u);
- MOZ_ASSERT(mozilla::GCD(7079489553626522083u, 2723660727447617723u) == 1u);
- MOZ_ASSERT(mozilla::GCD(6456428365552053201u, 1199403261032183111u) == 1u);
- MOZ_ASSERT(mozilla::GCD(3346567208089938575u, 2383119761029013459u) == 1u);
- MOZ_ASSERT(mozilla::GCD(11371634586699820652u, 1314783250642191861u) == 1u);
- MOZ_ASSERT(mozilla::GCD(17865943339510318926u, 6852058968402585010u) == 2u);
- MOZ_ASSERT(mozilla::GCD(6184068614737379672u, 3615164034002231440u) == 8u);
- MOZ_ASSERT(mozilla::GCD(4188759555626894588u, 756597961380253895u) == 1u);
- MOZ_ASSERT(mozilla::GCD(9834711092513827417u, 3337572906055372223u) == 1u);
- MOZ_ASSERT(mozilla::GCD(15971004526745900665u, 8185256010881285296u) == 1u);
- MOZ_ASSERT(mozilla::GCD(15018742812984668959u, 529070670894924960u) == 1u);
- MOZ_ASSERT(mozilla::GCD(1067863751656464299u, 905318428655384382u) == 1u);
- MOZ_ASSERT(mozilla::GCD(13862829046112265837u, 6101005940549725663u) == 1u);
- MOZ_ASSERT(mozilla::GCD(5042641015440071021u, 3851032995323622058u) == 1u);
- MOZ_ASSERT(mozilla::GCD(12302889786666538640u, 10776548976024201292u) == 76u);
- MOZ_ASSERT(mozilla::GCD(13722399417473040071u, 9411461429949802122u) == 1u);
- MOZ_ASSERT(mozilla::GCD(7320504128957551347u, 54052915134765261u) == 3u);
- MOZ_ASSERT(mozilla::GCD(15757615267691124901u, 6960991167654285257u) == 1u);
- MOZ_ASSERT(mozilla::GCD(5748033181727727936u, 303811493931685833u) == 3u);
- MOZ_ASSERT(mozilla::GCD(13393585076101458038u, 11704741982068090192u) == 2u);
- MOZ_ASSERT(mozilla::GCD(1305962146520003941u, 900947650687182151u) == 1u);
- MOZ_ASSERT(mozilla::GCD(10210329619324275486u, 9165444096209531122u) == 2u);
- MOZ_ASSERT(mozilla::GCD(12287397750298100333u, 4589303685754232593u) == 1u);
- MOZ_ASSERT(mozilla::GCD(13074046732385479094u, 9410427502131685240u) == 2u);
- MOZ_ASSERT(mozilla::GCD(10769225306727183116u, 3766083633148275570u) == 2u);
- MOZ_ASSERT(mozilla::GCD(16097129444752648454u, 1689032025737433449u) == 1u);
- MOZ_ASSERT(mozilla::GCD(12569058547490329992u, 3311470626838389990u) == 18u);
- MOZ_ASSERT(mozilla::GCD(6800922789750937338u, 1401809431753492506u) == 6u);
- MOZ_ASSERT(mozilla::GCD(7640775166765881526u, 330467034911649653u) == 1u);
- MOZ_ASSERT(mozilla::GCD(7713745971481011689u, 2881741428874316968u) == 1u);
- MOZ_ASSERT(mozilla::GCD(3447718804232188171u, 2048968371582835027u) == 17u);
- MOZ_ASSERT(mozilla::GCD(5048117340512952935u, 2723523492436699844u) == 1u);
- MOZ_ASSERT(mozilla::GCD(10307361968692211723u, 428905266774914488u) == 1u);
- MOZ_ASSERT(mozilla::GCD(1319115090575683914u, 1262779939989801116u) == 2u);
- MOZ_ASSERT(mozilla::GCD(12690110976610715926u, 1527151730024909348u) == 2u);
- MOZ_ASSERT(mozilla::GCD(12963032302522784237u, 8894543024067386192u) == 1u);
- MOZ_ASSERT(mozilla::GCD(4719664701853305298u, 328290838903591497u) == 1u);
- MOZ_ASSERT(mozilla::GCD(6046363361224867225u, 2463351775539510194u) == 1u);
- MOZ_ASSERT(mozilla::GCD(467063656725960574u, 62796777888499328u) == 2u);
- MOZ_ASSERT(mozilla::GCD(16390445286228133923u, 3793827091023779027u) == 1u);
- MOZ_ASSERT(mozilla::GCD(3118497337756941652u, 2860811741849353064u) == 4u);
- MOZ_ASSERT(mozilla::GCD(17480668716240157222u, 6736393718990377613u) == 1u);
- MOZ_ASSERT(mozilla::GCD(3008091962262081749u, 2764474578829797968u) == 1u);
- MOZ_ASSERT(mozilla::GCD(10443605258088065132u, 1118236736154633837u) == 1u);
- MOZ_ASSERT(mozilla::GCD(8681282777233478597u, 2520450074320754822u) == 1u);
- MOZ_ASSERT(mozilla::GCD(2428054799146631800u, 2304419668216461210u) == 10u);
- MOZ_ASSERT(mozilla::GCD(11986346113373252908u, 5868466983065345812u) == 4u);
- MOZ_ASSERT(mozilla::GCD(566070446598076689u, 226910043938150340u) == 3u);
- MOZ_ASSERT(mozilla::GCD(20286446051392853u, 2253005103754547u) == 1u);
- MOZ_ASSERT(mozilla::GCD(9478145873341733534u, 1361277916695374175u) == 1u);
- MOZ_ASSERT(mozilla::GCD(2194077616952029858u, 1880982148321238243u) == 1u);
- MOZ_ASSERT(mozilla::GCD(5067528875217388843u, 1007391120419508106u) == 1u);
- MOZ_ASSERT(mozilla::GCD(14964775244731205772u, 8476706085421248933u) == 3u);
- MOZ_ASSERT(mozilla::GCD(15864657026011160414u, 11542748143033682677u) == 1u);
- MOZ_ASSERT(mozilla::GCD(6819186727513097073u, 3374817819083626717u) == 1u);
- MOZ_ASSERT(mozilla::GCD(14864653919493481829u, 1475678482546800916u) == 1u);
- MOZ_ASSERT(mozilla::GCD(674964986925038761u, 500070581922501698u) == 1u);
- MOZ_ASSERT(mozilla::GCD(5286379749864372936u, 1077542296477907313u) == 3u);
- MOZ_ASSERT(mozilla::GCD(506827427986892036u, 177356571976309469u) == 1u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(16747832015348854198u, 10986175599217457242u) == 2u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(14011882763672869646u, 1150181481133900726u) == 2u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(6605029198216299492u, 2540177763690679863u) ==
+ 3u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(8723446333453359635u, 5501999887069319528u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2056609692029140361u, 1456692183174011231u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3979920159703007405u, 2102351633956912159u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(9463892761763926474u, 5727651032816755587u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(15074653294321365395u, 7500084005319994862u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(7596876989397200146u, 2100623677138635163u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(15788975435035111366u, 13949507094186899135u) == 1u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(11511089994271140687u, 11202842908571961185u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(5238481506779057035u, 1275096406977139452u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(10319988989820236521u, 6004256112028859859u) == 1u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(15363016657999062582u, 13709656670722381934u) == 2u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1212882338768103987u, 400304873392680016u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(14516701884936382582u, 9474965125574306885u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(4684990176797036518u, 2826010316418750908u) ==
+ 2u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1257550743165743081u, 501524040422212694u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2684107647237574540u, 1059404913392538915u) ==
+ 5u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(9075798209725656040u, 8460431147770771484u) ==
+ 4u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(8849414266308239550u, 2100344973594953676u) ==
+ 6u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(18235452615524492166u, 6948238589518088517u) == 3u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(15050298436941428700u, 1467533438133155187u) == 3u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(8834598722016252963u, 4311275747815972852u) ==
+ 17u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(9356558625132137133u, 2037947968328350721u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3849613153563955590u, 742698742609310596u) ==
+ 2u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(14456988562990139501u, 10112205238651656021u) == 1u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(12307508681986233124u, 9812326358082292497u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1542509761845906606u, 753342053499303952u) ==
+ 2u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3002452874498902380u, 1551203246991573851u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(6995746439795805457u, 1188069610619158471u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2746395460341933223u, 2567350813567392270u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(13780256804547757349u, 3248441336598733689u) == 1u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(11585262422698980788u, 9223319679416307971u) == 1u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(12061506913736835258u, 4388981418731026638u) == 54u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(7926097431519628264u, 6609465824726553267u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(4869073093357623730u, 127092341961569309u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2415749375652736599u, 1225333195065764619u) ==
+ 3u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(12396258519293261927u, 7854932518032305093u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(8482841866529133449u, 8041279973223483861u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(6256232276718808317u, 218093546248209886u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(8708964372422992556u, 5925839455605803265u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(7079489553626522083u, 2723660727447617723u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(6456428365552053201u, 1199403261032183111u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3346567208089938575u, 2383119761029013459u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(11371634586699820652u, 1314783250642191861u) == 1u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(17865943339510318926u, 6852058968402585010u) == 2u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(6184068614737379672u, 3615164034002231440u) ==
+ 8u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(4188759555626894588u, 756597961380253895u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(9834711092513827417u, 3337572906055372223u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(15971004526745900665u, 8185256010881285296u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(15018742812984668959u, 529070670894924960u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1067863751656464299u, 905318428655384382u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(13862829046112265837u, 6101005940549725663u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(5042641015440071021u, 3851032995323622058u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(12302889786666538640u, 10776548976024201292u) == 76u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(13722399417473040071u, 9411461429949802122u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(7320504128957551347u, 54052915134765261u) ==
+ 3u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(15757615267691124901u, 6960991167654285257u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(5748033181727727936u, 303811493931685833u) ==
+ 3u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(13393585076101458038u, 11704741982068090192u) == 2u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1305962146520003941u, 900947650687182151u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(10210329619324275486u, 9165444096209531122u) == 2u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(12287397750298100333u, 4589303685754232593u) == 1u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(13074046732385479094u, 9410427502131685240u) == 2u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(10769225306727183116u, 3766083633148275570u) == 2u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(16097129444752648454u, 1689032025737433449u) == 1u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(12569058547490329992u, 3311470626838389990u) == 18u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(6800922789750937338u, 1401809431753492506u) ==
+ 6u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(7640775166765881526u, 330467034911649653u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(7713745971481011689u, 2881741428874316968u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3447718804232188171u, 2048968371582835027u) ==
+ 17u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(5048117340512952935u, 2723523492436699844u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(10307361968692211723u, 428905266774914488u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1319115090575683914u, 1262779939989801116u) ==
+ 2u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(12690110976610715926u, 1527151730024909348u) == 2u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(12963032302522784237u, 8894543024067386192u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(4719664701853305298u, 328290838903591497u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(6046363361224867225u, 2463351775539510194u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(467063656725960574u, 62796777888499328u) ==
+ 2u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(16390445286228133923u, 3793827091023779027u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3118497337756941652u, 2860811741849353064u) ==
+ 4u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(17480668716240157222u, 6736393718990377613u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3008091962262081749u, 2764474578829797968u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(10443605258088065132u, 1118236736154633837u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(8681282777233478597u, 2520450074320754822u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2428054799146631800u, 2304419668216461210u) ==
+ 10u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(11986346113373252908u, 5868466983065345812u) == 4u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(566070446598076689u, 226910043938150340u) ==
+ 3u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(20286446051392853u, 2253005103754547u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(9478145873341733534u, 1361277916695374175u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2194077616952029858u, 1880982148321238243u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(5067528875217388843u, 1007391120419508106u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(14964775244731205772u, 8476706085421248933u) == 3u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(15864657026011160414u, 11542748143033682677u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(6819186727513097073u, 3374817819083626717u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(
+ mozilla::GCD(14864653919493481829u, 1475678482546800916u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(674964986925038761u, 500070581922501698u) ==
+ 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(5286379749864372936u, 1077542296477907313u) ==
+ 3u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(506827427986892036u, 177356571976309469u) ==
+ 1u);
// signed 32-bits integers
- MOZ_ASSERT(mozilla::GCD(2082847559, 1075502059) == 1);
- MOZ_ASSERT(mozilla::GCD(1516817880, 1427978452) == 4);
- MOZ_ASSERT(mozilla::GCD(1912103032, 865754441) == 1);
- MOZ_ASSERT(mozilla::GCD(1907998028, 1578360455) == 1);
- MOZ_ASSERT(mozilla::GCD(2082786344, 1864664012) == 4);
- MOZ_ASSERT(mozilla::GCD(2060961011, 1928455778) == 1);
- MOZ_ASSERT(mozilla::GCD(970664659, 63074065) == 1);
- MOZ_ASSERT(mozilla::GCD(55960901, 36955491) == 1);
- MOZ_ASSERT(mozilla::GCD(1136602528, 339758054) == 2);
- MOZ_ASSERT(mozilla::GCD(2040420582, 1355439044) == 2);
- MOZ_ASSERT(mozilla::GCD(1295522905, 736231412) == 1);
- MOZ_ASSERT(mozilla::GCD(778941225, 674482877) == 1);
- MOZ_ASSERT(mozilla::GCD(291862772, 262751987) == 1);
- MOZ_ASSERT(mozilla::GCD(233275018, 60278627) == 1);
- MOZ_ASSERT(mozilla::GCD(701740307, 432255046) == 1);
- MOZ_ASSERT(mozilla::GCD(582766531, 457298210) == 1);
- MOZ_ASSERT(mozilla::GCD(196369046, 15577226) == 2);
- MOZ_ASSERT(mozilla::GCD(1342156837, 2790339) == 1);
- MOZ_ASSERT(mozilla::GCD(502348102, 151073265) == 1);
- MOZ_ASSERT(mozilla::GCD(836867611, 797891653) == 1);
- MOZ_ASSERT(mozilla::GCD(859055751, 525520896) == 3);
- MOZ_ASSERT(mozilla::GCD(701234220, 683730404) == 4);
- MOZ_ASSERT(mozilla::GCD(2102253469, 1046820362) == 1);
- MOZ_ASSERT(mozilla::GCD(1712691453, 34616585) == 1);
- MOZ_ASSERT(mozilla::GCD(1074235876, 683609889) == 1);
- MOZ_ASSERT(mozilla::GCD(535965177, 182306069) == 11);
- MOZ_ASSERT(mozilla::GCD(1437763442, 180698008) == 2);
- MOZ_ASSERT(mozilla::GCD(2005641602, 175306737) == 1);
- MOZ_ASSERT(mozilla::GCD(803294953, 565920364) == 1);
- MOZ_ASSERT(mozilla::GCD(2135931435, 220153322) == 1);
- MOZ_ASSERT(mozilla::GCD(1002010726, 619364124) == 2);
- MOZ_ASSERT(mozilla::GCD(1841159587, 577256747) == 1);
- MOZ_ASSERT(mozilla::GCD(2117547620, 896973794) == 2);
- MOZ_ASSERT(mozilla::GCD(2004836234, 157238204) == 2);
- MOZ_ASSERT(mozilla::GCD(952368407, 625062194) == 1);
- MOZ_ASSERT(mozilla::GCD(671144794, 357719289) == 1);
- MOZ_ASSERT(mozilla::GCD(1369585680, 279330845) == 5);
- MOZ_ASSERT(mozilla::GCD(389855496, 230820785) == 1);
- MOZ_ASSERT(mozilla::GCD(2101505071, 572728762) == 1);
- MOZ_ASSERT(mozilla::GCD(1657802296, 667524476) == 4);
- MOZ_ASSERT(mozilla::GCD(1007298072, 598682608) == 8);
- MOZ_ASSERT(mozilla::GCD(1499193816, 44129206) == 2);
- MOZ_ASSERT(mozilla::GCD(1355799723, 1163556923) == 1);
- MOZ_ASSERT(mozilla::GCD(346410469, 294136125) == 1);
- MOZ_ASSERT(mozilla::GCD(240297386, 239749630) == 2);
- MOZ_ASSERT(mozilla::GCD(1595986655, 706220030) == 5);
- MOZ_ASSERT(mozilla::GCD(265850446, 117414954) == 2);
- MOZ_ASSERT(mozilla::GCD(1594478812, 559606261) == 1);
- MOZ_ASSERT(mozilla::GCD(1098933117, 145267674) == 3);
- MOZ_ASSERT(mozilla::GCD(37749195, 34174284) == 3);
- MOZ_ASSERT(mozilla::GCD(173141528, 158277345) == 1);
- MOZ_ASSERT(mozilla::GCD(1523316779, 1507242666) == 1);
- MOZ_ASSERT(mozilla::GCD(1574321272, 213222586) == 2);
- MOZ_ASSERT(mozilla::GCD(186241582, 58675779) == 1);
- MOZ_ASSERT(mozilla::GCD(1351024876, 1256961567) == 1);
- MOZ_ASSERT(mozilla::GCD(2060871503, 1626844669) == 1);
- MOZ_ASSERT(mozilla::GCD(794617235, 606782933) == 1);
- MOZ_ASSERT(mozilla::GCD(620853401, 550785717) == 1);
- MOZ_ASSERT(mozilla::GCD(978990617, 684228903) == 1);
- MOZ_ASSERT(mozilla::GCD(185414372, 160958435) == 11);
- MOZ_ASSERT(mozilla::GCD(13886275, 10781501) == 1);
- MOZ_ASSERT(mozilla::GCD(316445410, 72994145) == 5);
- MOZ_ASSERT(mozilla::GCD(260685833, 66561321) == 1);
- MOZ_ASSERT(mozilla::GCD(656788852, 619471100) == 4);
- MOZ_ASSERT(mozilla::GCD(409924450, 323144710) == 10);
- MOZ_ASSERT(mozilla::GCD(1696374689, 155122424) == 1);
- MOZ_ASSERT(mozilla::GCD(1720449495, 1332196090) == 5);
- MOZ_ASSERT(mozilla::GCD(102504868, 95625294) == 2);
- MOZ_ASSERT(mozilla::GCD(959039064, 266180243) == 1);
- MOZ_ASSERT(mozilla::GCD(771762738, 99126507) == 3);
- MOZ_ASSERT(mozilla::GCD(1666721205, 164347293) == 3);
- MOZ_ASSERT(mozilla::GCD(1145868726, 1013299840) == 2);
- MOZ_ASSERT(mozilla::GCD(123667035, 6968726) == 1);
- MOZ_ASSERT(mozilla::GCD(856285310, 669026117) == 1);
- MOZ_ASSERT(mozilla::GCD(1748843942, 376021862) == 2);
- MOZ_ASSERT(mozilla::GCD(1364381942, 1316920424) == 2);
- MOZ_ASSERT(mozilla::GCD(376501104, 233350000) == 16);
- MOZ_ASSERT(mozilla::GCD(1516376773, 554534905) == 1);
- MOZ_ASSERT(mozilla::GCD(1355209533, 371401397) == 1);
- MOZ_ASSERT(mozilla::GCD(488029245, 453641230) == 5);
- MOZ_ASSERT(mozilla::GCD(2086782535, 1965901533) == 1);
- MOZ_ASSERT(mozilla::GCD(1701843138, 197489892) == 6);
- MOZ_ASSERT(mozilla::GCD(1857287302, 756127018) == 2);
- MOZ_ASSERT(mozilla::GCD(1806613582, 963087217) == 1);
- MOZ_ASSERT(mozilla::GCD(1350708388, 1013432485) == 1);
- MOZ_ASSERT(mozilla::GCD(742201232, 486590366) == 2);
- MOZ_ASSERT(mozilla::GCD(47378255, 18524009) == 1);
- MOZ_ASSERT(mozilla::GCD(750926792, 282203477) == 1);
- MOZ_ASSERT(mozilla::GCD(1242468272, 1225593358) == 2);
- MOZ_ASSERT(mozilla::GCD(1937337947, 1233008310) == 1);
- MOZ_ASSERT(mozilla::GCD(600511783, 563234297) == 1);
- MOZ_ASSERT(mozilla::GCD(1583895113, 1400349394) == 1);
- MOZ_ASSERT(mozilla::GCD(361950446, 20294144) == 26);
- MOZ_ASSERT(mozilla::GCD(712527923, 351368901) == 1);
- MOZ_ASSERT(mozilla::GCD(221252886, 13768150) == 2);
- MOZ_ASSERT(mozilla::GCD(1217530242, 184772639) == 1);
- MOZ_ASSERT(mozilla::GCD(1145522580, 92958612) == 12);
- MOZ_ASSERT(mozilla::GCD(1765854048, 1073605551) == 3);
- MOZ_ASSERT(mozilla::GCD(1179258112, 1148756377) == 1);
- MOZ_ASSERT(mozilla::GCD(211982661, 145365362) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2082847559, 1075502059) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1516817880, 1427978452) == 4);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1912103032, 865754441) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1907998028, 1578360455) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2082786344, 1864664012) == 4);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2060961011, 1928455778) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(970664659, 63074065) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(55960901, 36955491) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1136602528, 339758054) == 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2040420582, 1355439044) == 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1295522905, 736231412) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(778941225, 674482877) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(291862772, 262751987) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(233275018, 60278627) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(701740307, 432255046) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(582766531, 457298210) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(196369046, 15577226) == 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1342156837, 2790339) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(502348102, 151073265) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(836867611, 797891653) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(859055751, 525520896) == 3);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(701234220, 683730404) == 4);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2102253469, 1046820362) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1712691453, 34616585) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1074235876, 683609889) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(535965177, 182306069) == 11);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1437763442, 180698008) == 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2005641602, 175306737) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(803294953, 565920364) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2135931435, 220153322) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1002010726, 619364124) == 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1841159587, 577256747) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2117547620, 896973794) == 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2004836234, 157238204) == 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(952368407, 625062194) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(671144794, 357719289) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1369585680, 279330845) == 5);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(389855496, 230820785) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2101505071, 572728762) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1657802296, 667524476) == 4);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1007298072, 598682608) == 8);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1499193816, 44129206) == 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1355799723, 1163556923) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(346410469, 294136125) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(240297386, 239749630) == 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1595986655, 706220030) == 5);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(265850446, 117414954) == 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1594478812, 559606261) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1098933117, 145267674) == 3);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(37749195, 34174284) == 3);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(173141528, 158277345) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1523316779, 1507242666) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1574321272, 213222586) == 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(186241582, 58675779) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1351024876, 1256961567) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2060871503, 1626844669) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(794617235, 606782933) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(620853401, 550785717) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(978990617, 684228903) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(185414372, 160958435) == 11);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(13886275, 10781501) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(316445410, 72994145) == 5);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(260685833, 66561321) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(656788852, 619471100) == 4);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(409924450, 323144710) == 10);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1696374689, 155122424) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1720449495, 1332196090) == 5);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(102504868, 95625294) == 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(959039064, 266180243) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(771762738, 99126507) == 3);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1666721205, 164347293) == 3);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1145868726, 1013299840) == 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(123667035, 6968726) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(856285310, 669026117) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1748843942, 376021862) == 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1364381942, 1316920424) == 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(376501104, 233350000) == 16);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1516376773, 554534905) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1355209533, 371401397) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(488029245, 453641230) == 5);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2086782535, 1965901533) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1701843138, 197489892) == 6);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1857287302, 756127018) == 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1806613582, 963087217) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1350708388, 1013432485) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(742201232, 486590366) == 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(47378255, 18524009) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(750926792, 282203477) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1242468272, 1225593358) == 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1937337947, 1233008310) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(600511783, 563234297) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1583895113, 1400349394) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(361950446, 20294144) == 26);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(712527923, 351368901) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(221252886, 13768150) == 2);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1217530242, 184772639) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1145522580, 92958612) == 12);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1765854048, 1073605551) == 3);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1179258112, 1148756377) == 1);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(211982661, 145365362) == 1);
// unsigned 32-bits integers
- MOZ_ASSERT(mozilla::GCD(2346624228u, 854636854u) == 2u);
- MOZ_ASSERT(mozilla::GCD(257647411u, 113262213u) == 1u);
- MOZ_ASSERT(mozilla::GCD(532130107u, 181815062u) == 1u);
- MOZ_ASSERT(mozilla::GCD(188329196u, 21767880u) == 4u);
- MOZ_ASSERT(mozilla::GCD(965417460u, 433449910u) == 10u);
- MOZ_ASSERT(mozilla::GCD(4285939108u, 782087256u) == 4u);
- MOZ_ASSERT(mozilla::GCD(3176833937u, 905249796u) == 1u);
- MOZ_ASSERT(mozilla::GCD(1596497177u, 1259467765u) == 1u);
- MOZ_ASSERT(mozilla::GCD(296928708u, 137867254u) == 2u);
- MOZ_ASSERT(mozilla::GCD(810260571u, 278688539u) == 1u);
- MOZ_ASSERT(mozilla::GCD(2319673546u, 6698908u) == 2u);
- MOZ_ASSERT(mozilla::GCD(335032855u, 304923748u) == 1u);
- MOZ_ASSERT(mozilla::GCD(1520046075u, 30861208u) == 1u);
- MOZ_ASSERT(mozilla::GCD(3370242674u, 2513781509u) == 1u);
- MOZ_ASSERT(mozilla::GCD(2380615411u, 41999289u) == 1u);
- MOZ_ASSERT(mozilla::GCD(2999947090u, 619047913u) == 1u);
- MOZ_ASSERT(mozilla::GCD(463491935u, 219826435u) == 5u);
- MOZ_ASSERT(mozilla::GCD(256795166u, 3240595u) == 1u);
- MOZ_ASSERT(mozilla::GCD(3794760062u, 542176354u) == 2u);
- MOZ_ASSERT(mozilla::GCD(2347135107u, 532837578u) == 3u);
- MOZ_ASSERT(mozilla::GCD(215263644u, 82185110u) == 2u);
- MOZ_ASSERT(mozilla::GCD(3242470340u, 1014909501u) == 1u);
- MOZ_ASSERT(mozilla::GCD(1935066897u, 1646318370u) == 3u);
- MOZ_ASSERT(mozilla::GCD(2528019825u, 2199478105u) == 5u);
- MOZ_ASSERT(mozilla::GCD(814340701u, 505422837u) == 1u);
- MOZ_ASSERT(mozilla::GCD(2422005621u, 1270490106u) == 3u);
- MOZ_ASSERT(mozilla::GCD(2196878780u, 2125974315u) == 5u);
- MOZ_ASSERT(mozilla::GCD(3243580525u, 3222120645u) == 5u);
- MOZ_ASSERT(mozilla::GCD(592838u, 333273u) == 1u);
- MOZ_ASSERT(mozilla::GCD(957856834u, 660922287u) == 1u);
- MOZ_ASSERT(mozilla::GCD(2650657380u, 2507896759u) == 1u);
- MOZ_ASSERT(mozilla::GCD(35861051u, 25878355u) == 1u);
- MOZ_ASSERT(mozilla::GCD(1907977010u, 514369620u) == 10u);
- MOZ_ASSERT(mozilla::GCD(1850153182u, 1133466079u) == 1u);
- MOZ_ASSERT(mozilla::GCD(2404132308u, 942620249u) == 1u);
- MOZ_ASSERT(mozilla::GCD(4120768767u, 794728522u) == 1u);
- MOZ_ASSERT(mozilla::GCD(3115077311u, 437206010u) == 1u);
- MOZ_ASSERT(mozilla::GCD(3653354572u, 3501340268u) == 4u);
- MOZ_ASSERT(mozilla::GCD(3700775106u, 1237309608u) == 6u);
- MOZ_ASSERT(mozilla::GCD(3838425682u, 2767520531u) == 1u);
- MOZ_ASSERT(mozilla::GCD(812123689u, 691153768u) == 1u);
- MOZ_ASSERT(mozilla::GCD(3201500844u, 1530832674u) == 6u);
- MOZ_ASSERT(mozilla::GCD(802121923u, 753535009u) == 1u);
- MOZ_ASSERT(mozilla::GCD(575392026u, 450096822u) == 6u);
- MOZ_ASSERT(mozilla::GCD(1074039450u, 724299558u) == 6u);
- MOZ_ASSERT(mozilla::GCD(3785968159u, 230568577u) == 1u);
- MOZ_ASSERT(mozilla::GCD(80611731u, 30537579u) == 3u);
- MOZ_ASSERT(mozilla::GCD(3717744094u, 3192172824u) == 2u);
- MOZ_ASSERT(mozilla::GCD(3481208739u, 3389567399u) == 1u);
- MOZ_ASSERT(mozilla::GCD(1126134290u, 760589919u) == 1u);
- MOZ_ASSERT(mozilla::GCD(2452072599u, 1235840929u) == 1u);
- MOZ_ASSERT(mozilla::GCD(4172574373u, 664346996u) == 1u);
- MOZ_ASSERT(mozilla::GCD(4280275945u, 1940565231u) == 11u);
- MOZ_ASSERT(mozilla::GCD(1138803378u, 919205598u) == 6u);
- MOZ_ASSERT(mozilla::GCD(3871971423u, 3071143517u) == 1u);
- MOZ_ASSERT(mozilla::GCD(1889403334u, 261936800u) == 2u);
- MOZ_ASSERT(mozilla::GCD(1233462464u, 462090021u) == 1u);
- MOZ_ASSERT(mozilla::GCD(267801361u, 177041892u) == 1u);
- MOZ_ASSERT(mozilla::GCD(1586528261u, 1146114428u) == 1u);
- MOZ_ASSERT(mozilla::GCD(2209381020u, 1616518545u) == 15u);
- MOZ_ASSERT(mozilla::GCD(2493819993u, 110364986u) == 1u);
- MOZ_ASSERT(mozilla::GCD(105420984u, 83814372u) == 12u);
- MOZ_ASSERT(mozilla::GCD(3093899047u, 917349662u) == 1u);
- MOZ_ASSERT(mozilla::GCD(3716325890u, 1554865432u) == 2u);
- MOZ_ASSERT(mozilla::GCD(692565714u, 265467690u) == 18u);
- MOZ_ASSERT(mozilla::GCD(659720171u, 250624014u) == 1u);
- MOZ_ASSERT(mozilla::GCD(1890623148u, 1632453222u) == 6u);
- MOZ_ASSERT(mozilla::GCD(3557986303u, 752931252u) == 1u);
- MOZ_ASSERT(mozilla::GCD(237903157u, 177153319u) == 1u);
- MOZ_ASSERT(mozilla::GCD(4133928804u, 3898800943u) == 1u);
- MOZ_ASSERT(mozilla::GCD(1783300920u, 196251347u) == 1u);
- MOZ_ASSERT(mozilla::GCD(2035190407u, 866039372u) == 1u);
- MOZ_ASSERT(mozilla::GCD(3893680107u, 3211053018u) == 3u);
- MOZ_ASSERT(mozilla::GCD(4293646715u, 2698207329u) == 1u);
- MOZ_ASSERT(mozilla::GCD(1409442959u, 151043902u) == 1u);
- MOZ_ASSERT(mozilla::GCD(1823328305u, 375231671u) == 1u);
- MOZ_ASSERT(mozilla::GCD(2574512647u, 1902834298u) == 1u);
- MOZ_ASSERT(mozilla::GCD(2533783127u, 1232079823u) == 1u);
- MOZ_ASSERT(mozilla::GCD(2622446878u, 193328426u) == 2u);
- MOZ_ASSERT(mozilla::GCD(4099571222u, 3439224331u) == 1u);
- MOZ_ASSERT(mozilla::GCD(2355797345u, 430435034u) == 1u);
- MOZ_ASSERT(mozilla::GCD(2654318392u, 2069135952u) == 8u);
- MOZ_ASSERT(mozilla::GCD(1671976410u, 1100794671u) == 3u);
- MOZ_ASSERT(mozilla::GCD(328877177u, 236038245u) == 1u);
- MOZ_ASSERT(mozilla::GCD(2373247523u, 1198763899u) == 1u);
- MOZ_ASSERT(mozilla::GCD(3230550971u, 203517406u) == 1u);
- MOZ_ASSERT(mozilla::GCD(2274958703u, 353643804u) == 1u);
- MOZ_ASSERT(mozilla::GCD(1048415366u, 740416576u) == 2u);
- MOZ_ASSERT(mozilla::GCD(2768590397u, 843179468u) == 1u);
- MOZ_ASSERT(mozilla::GCD(2839858158u, 1019946790u) == 2u);
- MOZ_ASSERT(mozilla::GCD(4116867766u, 52672530u) == 2u);
- MOZ_ASSERT(mozilla::GCD(3433787325u, 2398189631u) == 1u);
- MOZ_ASSERT(mozilla::GCD(2636022376u, 2289412838u) == 2u);
- MOZ_ASSERT(mozilla::GCD(2904900253u, 2748915828u) == 1u);
- MOZ_ASSERT(mozilla::GCD(4041240379u, 605321815u) == 1u);
- MOZ_ASSERT(mozilla::GCD(1730010566u, 92436785u) == 1u);
- MOZ_ASSERT(mozilla::GCD(1362635513u, 757365378u) == 1u);
- MOZ_ASSERT(mozilla::GCD(1327133482u, 940350094u) == 2u);
- MOZ_ASSERT(mozilla::GCD(3515019959u, 810874750u) == 1u);
- MOZ_ASSERT(mozilla::GCD(82871503u, 43900000u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2346624228u, 854636854u) == 2u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(257647411u, 113262213u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(532130107u, 181815062u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(188329196u, 21767880u) == 4u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(965417460u, 433449910u) == 10u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(4285939108u, 782087256u) == 4u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3176833937u, 905249796u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1596497177u, 1259467765u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(296928708u, 137867254u) == 2u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(810260571u, 278688539u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2319673546u, 6698908u) == 2u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(335032855u, 304923748u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1520046075u, 30861208u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3370242674u, 2513781509u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2380615411u, 41999289u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2999947090u, 619047913u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(463491935u, 219826435u) == 5u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(256795166u, 3240595u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3794760062u, 542176354u) == 2u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2347135107u, 532837578u) == 3u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(215263644u, 82185110u) == 2u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3242470340u, 1014909501u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1935066897u, 1646318370u) == 3u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2528019825u, 2199478105u) == 5u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(814340701u, 505422837u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2422005621u, 1270490106u) == 3u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2196878780u, 2125974315u) == 5u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3243580525u, 3222120645u) == 5u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(592838u, 333273u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(957856834u, 660922287u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2650657380u, 2507896759u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(35861051u, 25878355u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1907977010u, 514369620u) == 10u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1850153182u, 1133466079u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2404132308u, 942620249u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(4120768767u, 794728522u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3115077311u, 437206010u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3653354572u, 3501340268u) == 4u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3700775106u, 1237309608u) == 6u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3838425682u, 2767520531u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(812123689u, 691153768u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3201500844u, 1530832674u) == 6u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(802121923u, 753535009u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(575392026u, 450096822u) == 6u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1074039450u, 724299558u) == 6u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3785968159u, 230568577u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(80611731u, 30537579u) == 3u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3717744094u, 3192172824u) == 2u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3481208739u, 3389567399u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1126134290u, 760589919u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2452072599u, 1235840929u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(4172574373u, 664346996u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(4280275945u, 1940565231u) == 11u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1138803378u, 919205598u) == 6u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3871971423u, 3071143517u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1889403334u, 261936800u) == 2u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1233462464u, 462090021u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(267801361u, 177041892u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1586528261u, 1146114428u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2209381020u, 1616518545u) == 15u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2493819993u, 110364986u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(105420984u, 83814372u) == 12u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3093899047u, 917349662u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3716325890u, 1554865432u) == 2u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(692565714u, 265467690u) == 18u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(659720171u, 250624014u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1890623148u, 1632453222u) == 6u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3557986303u, 752931252u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(237903157u, 177153319u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(4133928804u, 3898800943u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1783300920u, 196251347u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2035190407u, 866039372u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3893680107u, 3211053018u) == 3u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(4293646715u, 2698207329u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1409442959u, 151043902u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1823328305u, 375231671u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2574512647u, 1902834298u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2533783127u, 1232079823u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2622446878u, 193328426u) == 2u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(4099571222u, 3439224331u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2355797345u, 430435034u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2654318392u, 2069135952u) == 8u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1671976410u, 1100794671u) == 3u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(328877177u, 236038245u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2373247523u, 1198763899u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3230550971u, 203517406u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2274958703u, 353643804u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1048415366u, 740416576u) == 2u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2768590397u, 843179468u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2839858158u, 1019946790u) == 2u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(4116867766u, 52672530u) == 2u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3433787325u, 2398189631u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2636022376u, 2289412838u) == 2u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(2904900253u, 2748915828u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(4041240379u, 605321815u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1730010566u, 92436785u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1362635513u, 757365378u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(1327133482u, 940350094u) == 2u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3515019959u, 810874750u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(82871503u, 43900000u) == 1u);
- MOZ_ASSERT(mozilla::GCD(3u, 7u) == 1u);
+ MOZ_RELEASE_ASSERT(mozilla::GCD(3u, 7u) == 1u);
}
int main() {
diff --git a/mfbt/tests/TestMaybe.cpp b/mfbt/tests/TestMaybe.cpp
index f9e5ae00dc..ea39b2864c 100644
--- a/mfbt/tests/TestMaybe.cpp
+++ b/mfbt/tests/TestMaybe.cpp
@@ -17,13 +17,13 @@ using mozilla::SomeRef;
using mozilla::ToMaybe;
using mozilla::ToMaybeRef;
-#define RUN_TEST(t) \
- do { \
- bool cond = (t()); \
- if (!cond) return 1; \
- cond = AllDestructorsWereCalled(); \
- MOZ_ASSERT(cond, "Failed to destroy all objects during test: " #t); \
- if (!cond) return 1; \
+#define RUN_TEST(t) \
+ do { \
+ bool cond = (t()); \
+ MOZ_RELEASE_ASSERT(cond, "Unexpectedly returned false during test: " #t); \
+ cond = AllDestructorsWereCalled(); \
+ MOZ_RELEASE_ASSERT(cond, \
+ "Failed to destroy all objects during test: " #t); \
} while (false)
enum Status {
diff --git a/mfbt/tests/TestRefPtr.cpp b/mfbt/tests/TestRefPtr.cpp
index 972e284c44..489b120ae2 100644
--- a/mfbt/tests/TestRefPtr.cpp
+++ b/mfbt/tests/TestRefPtr.cpp
@@ -20,7 +20,7 @@ class Foo : public RefCounted<Foo> {
static int sNumDestroyed;
~Foo() {
- MOZ_ASSERT(!mDead);
+ MOZ_RELEASE_ASSERT(!mDead);
mDead = true;
sNumDestroyed++;
}
diff --git a/mfbt/tests/TestResult.cpp b/mfbt/tests/TestResult.cpp
index a2e10640c5..f03f06b03c 100644
--- a/mfbt/tests/TestResult.cpp
+++ b/mfbt/tests/TestResult.cpp
@@ -852,6 +852,50 @@ void UpcastTest() {
}
}
+void EqualityTest() {
+ {
+ Result<int, bool> result(1);
+ Result<int, bool> other(1);
+
+ MOZ_RELEASE_ASSERT(result == other);
+ }
+
+ {
+ Result<int, bool> result(true);
+ Result<int, bool> other(true);
+
+ MOZ_RELEASE_ASSERT(result == other);
+ }
+
+ {
+ Result<int, bool> result(1);
+ Result<int, bool> other(2);
+
+ MOZ_RELEASE_ASSERT(result != other);
+ }
+
+ {
+ Result<int, bool> result(true);
+ Result<int, bool> other(false);
+
+ MOZ_RELEASE_ASSERT(result != other);
+ }
+
+ {
+ Result<int, bool> result(0);
+ Result<int, bool> other(false);
+
+ MOZ_RELEASE_ASSERT(result != other);
+ }
+
+ {
+ Result<int, unsigned int> result(1);
+ Result<int, unsigned int> other(1u);
+
+ MOZ_RELEASE_ASSERT(result != other);
+ }
+}
+
/* * */
int main() {
@@ -866,5 +910,6 @@ int main() {
UniquePtrTest();
ZeroIsEmptyErrorTest();
UpcastTest();
+ EqualityTest();
return 0;
}
diff --git a/mfbt/tests/TestUniquePtr.cpp b/mfbt/tests/TestUniquePtr.cpp
index 03f9033fe5..be49230e6e 100644
--- a/mfbt/tests/TestUniquePtr.cpp
+++ b/mfbt/tests/TestUniquePtr.cpp
@@ -21,13 +21,10 @@ using mozilla::UniqueFreePtr;
using mozilla::UniquePtr;
using mozilla::Vector;
-#define CHECK(c) \
- do { \
- bool cond = !!(c); \
- MOZ_ASSERT(cond, "Failed assertion: " #c); \
- if (!cond) { \
- return false; \
- } \
+#define CHECK(c) \
+ do { \
+ bool cond = !!(c); \
+ MOZ_RELEASE_ASSERT(cond, "Test failed: " #c); \
} while (false)
typedef UniquePtr<int> NewInt;
diff --git a/mfbt/tests/TestVector.cpp b/mfbt/tests/TestVector.cpp
index 021d02976b..23928f08d3 100644
--- a/mfbt/tests/TestVector.cpp
+++ b/mfbt/tests/TestVector.cpp
@@ -350,28 +350,28 @@ void mozilla::detail::VectorTesting::testReplaceRawBuffer() {
MOZ_RELEASE_ASSERT(v.reserve(4));
v.infallibleEmplaceBack(1, 2);
v.infallibleEmplaceBack(3, 4);
- MOZ_ASSERT(S::constructCount == 2);
+ MOZ_RELEASE_ASSERT(S::constructCount == 2);
s = v.extractRawBuffer();
}
- MOZ_ASSERT(S::constructCount == 2);
- MOZ_ASSERT(S::moveCount == 0);
- MOZ_ASSERT(S::destructCount == 0);
+ MOZ_RELEASE_ASSERT(S::constructCount == 2);
+ MOZ_RELEASE_ASSERT(S::moveCount == 0);
+ MOZ_RELEASE_ASSERT(S::destructCount == 0);
{
Vector<S, 10> v;
v.replaceRawBuffer(s, 2);
- MOZ_ASSERT(v.length() == 2);
MOZ_ASSERT(v.reserved() == 2);
- MOZ_ASSERT(v.capacity() == 10);
- MOZ_ASSERT(v[0].j == 1);
- MOZ_ASSERT(v[1].j == 3);
- MOZ_ASSERT(S::destructCount == 2);
+ MOZ_RELEASE_ASSERT(v.length() == 2);
+ MOZ_RELEASE_ASSERT(v.capacity() == 10);
+ MOZ_RELEASE_ASSERT(v[0].j == 1);
+ MOZ_RELEASE_ASSERT(v[1].j == 3);
+ MOZ_RELEASE_ASSERT(S::destructCount == 2);
}
- MOZ_ASSERT(S::constructCount == 2);
- MOZ_ASSERT(S::moveCount == 2);
- MOZ_ASSERT(S::destructCount == 4);
+ MOZ_RELEASE_ASSERT(S::constructCount == 2);
+ MOZ_RELEASE_ASSERT(S::moveCount == 2);
+ MOZ_RELEASE_ASSERT(S::destructCount == 4);
S::resetCounts();
@@ -379,30 +379,30 @@ void mozilla::detail::VectorTesting::testReplaceRawBuffer() {
Vector<S, 2> v;
MOZ_RELEASE_ASSERT(v.reserve(4));
v.infallibleEmplaceBack(9, 10);
- MOZ_ASSERT(S::constructCount == 1);
+ MOZ_RELEASE_ASSERT(S::constructCount == 1);
s = v.extractRawBuffer();
- MOZ_ASSERT(S::constructCount == 1);
- MOZ_ASSERT(S::moveCount == 0);
+ MOZ_RELEASE_ASSERT(S::constructCount == 1);
+ MOZ_RELEASE_ASSERT(S::moveCount == 0);
}
- MOZ_ASSERT(S::destructCount == 0);
+ MOZ_RELEASE_ASSERT(S::destructCount == 0);
{
Vector<S> v;
v.replaceRawBuffer(s, 1, 4);
- MOZ_ASSERT(v.length() == 1);
MOZ_ASSERT(v.reserved() == 4);
- MOZ_ASSERT(v.capacity() == 4);
- MOZ_ASSERT(v[0].j == 9);
+ MOZ_RELEASE_ASSERT(v.length() == 1);
+ MOZ_RELEASE_ASSERT(v.capacity() == 4);
+ MOZ_RELEASE_ASSERT(v[0].j == 9);
for (size_t i = 0; i < 5; i++) MOZ_RELEASE_ASSERT(v.emplaceBack(i, i));
- MOZ_ASSERT(v.length() == 6);
MOZ_ASSERT(v.reserved() == 6);
- MOZ_ASSERT(S::constructCount == 6);
- MOZ_ASSERT(S::moveCount == 4);
- MOZ_ASSERT(S::destructCount == 4);
+ MOZ_RELEASE_ASSERT(v.length() == 6);
+ MOZ_RELEASE_ASSERT(S::constructCount == 6);
+ MOZ_RELEASE_ASSERT(S::moveCount == 4);
+ MOZ_RELEASE_ASSERT(S::destructCount == 4);
}
- MOZ_ASSERT(S::destructCount == 10);
+ MOZ_RELEASE_ASSERT(S::destructCount == 10);
}
void mozilla::detail::VectorTesting::testInsert() {
@@ -541,13 +541,13 @@ void mozilla::detail::VectorTesting::testShrinkStorageToFit() {
Vector<int, 0> v1;
MOZ_RELEASE_ASSERT(v1.reserve(10));
v1.infallibleAppend(1);
- MOZ_ASSERT(v1.length() == 1);
MOZ_ASSERT(v1.reserved() == 10);
- MOZ_ASSERT(v1.capacity() >= 10);
+ MOZ_RELEASE_ASSERT(v1.length() == 1);
+ MOZ_RELEASE_ASSERT(v1.capacity() >= 10);
v1.shrinkStorageToFit();
- MOZ_ASSERT(v1.length() == 1);
MOZ_ASSERT(v1.reserved() == 1);
- MOZ_ASSERT(v1.capacity() == 1);
+ MOZ_RELEASE_ASSERT(v1.length() == 1);
+ MOZ_RELEASE_ASSERT(v1.capacity() == 1);
}
// Vectors using inline storage do nothing.
@@ -555,13 +555,13 @@ void mozilla::detail::VectorTesting::testShrinkStorageToFit() {
Vector<int, 2> v2;
MOZ_RELEASE_ASSERT(v2.reserve(2));
v2.infallibleAppend(1);
- MOZ_ASSERT(v2.length() == 1);
MOZ_ASSERT(v2.reserved() == 2);
- MOZ_ASSERT(v2.capacity() == 2);
+ MOZ_RELEASE_ASSERT(v2.length() == 1);
+ MOZ_RELEASE_ASSERT(v2.capacity() == 2);
v2.shrinkStorageToFit();
- MOZ_ASSERT(v2.length() == 1);
MOZ_ASSERT(v2.reserved() == 2);
- MOZ_ASSERT(v2.capacity() == 2);
+ MOZ_RELEASE_ASSERT(v2.length() == 1);
+ MOZ_RELEASE_ASSERT(v2.capacity() == 2);
}
// shrinkStorageToFit uses inline storage if possible.
@@ -569,13 +569,13 @@ void mozilla::detail::VectorTesting::testShrinkStorageToFit() {
Vector<int, 2> v;
MOZ_RELEASE_ASSERT(v.reserve(4));
v.infallibleAppend(1);
- MOZ_ASSERT(v.length() == 1);
MOZ_ASSERT(v.reserved() == 4);
- MOZ_ASSERT(v.capacity() >= 4);
+ MOZ_RELEASE_ASSERT(v.length() == 1);
+ MOZ_RELEASE_ASSERT(v.capacity() >= 4);
v.shrinkStorageToFit();
- MOZ_ASSERT(v.length() == 1);
MOZ_ASSERT(v.reserved() == 1);
- MOZ_ASSERT(v.capacity() == 2);
+ MOZ_RELEASE_ASSERT(v.length() == 1);
+ MOZ_RELEASE_ASSERT(v.capacity() == 2);
}
// Non-pod shrinking to non-inline storage.
diff --git a/mfbt/tests/moz.build b/mfbt/tests/moz.build
index 231bec84a3..a8ef150aec 100644
--- a/mfbt/tests/moz.build
+++ b/mfbt/tests/moz.build
@@ -75,6 +75,7 @@ CppUnitTests(
if CONFIG["OS_ARCH"] != "WASI":
CppUnitTests(
[
+ "TestMPSCQueue",
"TestSPSCQueue",
"TestThreadSafeWeakPtr",
]