[dawn/common] Use default `<=>` operator on `TypedIntegerImpl`
Bug: 343500108
Change-Id: Ia19a98d25a731453911087cb32928c4fb1f9b894
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/240614
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Loko Kung <lokokung@google.com>
diff --git a/src/dawn/common/TypedInteger.h b/src/dawn/common/TypedInteger.h
index 0e87a9b..e3ebff7 100644
--- a/src/dawn/common/TypedInteger.h
+++ b/src/dawn/common/TypedInteger.h
@@ -28,6 +28,7 @@
#ifndef SRC_DAWN_COMMON_TYPEDINTEGER_H_
#define SRC_DAWN_COMMON_TYPEDINTEGER_H_
+#include <compare>
#include <limits>
#include <type_traits>
#include <utility>
@@ -101,16 +102,8 @@
// expect.
explicit constexpr operator T() const { return static_cast<T>(this->mValue); }
-// Same-tag TypedInteger comparison operators
-#define TYPED_COMPARISON(op) \
- constexpr bool operator op(const TypedIntegerImpl& rhs) const { return mValue op rhs.mValue; }
- TYPED_COMPARISON(<)
- TYPED_COMPARISON(<=)
- TYPED_COMPARISON(>)
- TYPED_COMPARISON(>=)
- TYPED_COMPARISON(==)
- TYPED_COMPARISON(!=)
-#undef TYPED_COMPARISON
+ // Same-tag TypedInteger comparison operators
+ constexpr auto operator<=>(const TypedIntegerImpl& rhs) const = default;
// Increment / decrement operators for for-loop iteration
constexpr TypedIntegerImpl& operator++() {