Bug 1349799 - Add PodEqual(T&,T&). - r=waldo
MozReview-Commit-ID: JKk0FJChLlp
--- a/mfbt/PodOperations.h
+++ b/mfbt/PodOperations.h
@@ -186,11 +186,19 @@ PodEqual(const T* one, const T* two, siz
*/
template <class T, size_t N>
static MOZ_ALWAYS_INLINE bool
PodEqual(const T (&one)[N], const T (&two)[N])
{
return PodEqual(one, two, N);
}
+/** Compare the raw bytes of two objects of the same type. */
+template<typename T>
+static MOZ_ALWAYS_INLINE bool
+PodEqual(const T& a, const T& b)
+{
+ return !memcmp(&a, &b, sizeof(T));
+}
+
} // namespace mozilla
#endif /* mozilla_PodOperations_h */