diff --git a/xpcom/glue/nsID.h b/xpcom/glue/nsID.h index 45f5ca058a5..4da9dc0ac09 100644 --- a/xpcom/glue/nsID.h +++ b/xpcom/glue/nsID.h @@ -72,15 +72,18 @@ struct nsID { */ inline PRBool Equals(const nsID& other) const { -#ifdef XP_UNIX + // One would think that this could be done faster with a really + // efficient implementation of memcmp(), but evidently no + // memcmp()'s out there are better than this code. + // + // See bug http://bugzilla.mozilla.org/show_bug.cgi?id=164580 for + // details. + return (PRBool) ((((PRUint32*) &m0)[0] == ((PRUint32*) &other.m0)[0]) && (((PRUint32*) &m0)[1] == ((PRUint32*) &other.m0)[1]) && (((PRUint32*) &m0)[2] == ((PRUint32*) &other.m0)[2]) && (((PRUint32*) &m0)[3] == ((PRUint32*) &other.m0)[3])); -#else - return (memcmp(this, &other, sizeof(*this)) == 0); -#endif } /**