зеркало из https://github.com/mozilla/pjs.git
Get rid of extra operators that we can get for free by including <algorithm>. Gets rid of gcc-2.7.2.3 ambiguity problems with new string APIs, too. r=scc
This commit is contained in:
Родитель
2259db6f0c
Коммит
c416940deb
|
@ -23,6 +23,7 @@
|
|||
#ifndef nsInt64_h__
|
||||
#define nsInt64_h__
|
||||
|
||||
#include <algorithm> // to get all comparisons given operator== and operator<
|
||||
#include "prlong.h"
|
||||
#include "nscore.h"
|
||||
|
||||
|
@ -177,11 +178,7 @@ public:
|
|||
|
||||
// Comparison operators
|
||||
friend inline PRBool operator ==(const nsInt64& aObject1, const nsInt64& aObject2);
|
||||
friend inline PRBool operator !=(const nsInt64& aObject1, const nsInt64& aObject2);
|
||||
friend inline PRBool operator >(const nsInt64& aObject1, const nsInt64& aObject2);
|
||||
friend inline PRBool operator >=(const nsInt64& aObject1, const nsInt64& aObject2);
|
||||
friend inline PRBool operator <(const nsInt64& aObject1, const nsInt64& aObject2);
|
||||
friend inline PRBool operator <=(const nsInt64& aObject1, const nsInt64& aObject2);
|
||||
|
||||
// Bitwise operators
|
||||
|
||||
|
@ -268,30 +265,6 @@ operator ==(const nsInt64& aObject1, const nsInt64& aObject2) {
|
|||
return LL_EQ(aObject1.mValue, aObject2.mValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if two 64-bit integers are not equal
|
||||
*/
|
||||
inline PRBool
|
||||
operator !=(const nsInt64& aObject1, const nsInt64& aObject2) {
|
||||
return LL_NE(aObject1.mValue, aObject2.mValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if one 64-bit integer is strictly greater than another, using signed values
|
||||
*/
|
||||
inline PRBool
|
||||
operator >(const nsInt64& aObject1, const nsInt64& aObject2) {
|
||||
return LL_CMP(aObject1.mValue, >, aObject2.mValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if one 64-bit integer is greater than or equal to another, using signed values
|
||||
*/
|
||||
inline PRBool
|
||||
operator >=(const nsInt64& aObject1, const nsInt64& aObject2) {
|
||||
return ! LL_CMP(aObject1.mValue, <, aObject2.mValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if one 64-bit integer is strictly less than another, using signed values
|
||||
*/
|
||||
|
@ -300,14 +273,6 @@ operator <(const nsInt64& aObject1, const nsInt64& aObject2) {
|
|||
return LL_CMP(aObject1.mValue, <, aObject2.mValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if one 64-bit integers is less than or equal to another, using signed values
|
||||
*/
|
||||
inline PRBool
|
||||
operator <=(const nsInt64& aObject1, const nsInt64& aObject2) {
|
||||
return ! LL_CMP(aObject1.mValue, >, aObject2.mValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a bitwise AND of two 64-bit integers
|
||||
*/
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#ifndef nsTime_h__
|
||||
#define nsTime_h__
|
||||
|
||||
#include <algorithm> // to get all comparisons given operator== and operator<
|
||||
#include "prtime.h"
|
||||
#include "nsInt64.h"
|
||||
#include "nscore.h"
|
||||
|
@ -115,11 +116,7 @@ public:
|
|||
|
||||
// Comparison operators
|
||||
friend const PRBool operator ==(const nsTime& aTime1, const nsTime& aTime2);
|
||||
friend const PRBool operator !=(const nsTime& aTime1, const nsTime& aTime2);
|
||||
friend const PRBool operator <(const nsTime& aTime1, const nsTime& aTime2);
|
||||
friend const PRBool operator <=(const nsTime& aTime1, const nsTime& aTime2);
|
||||
friend const PRBool operator >(const nsTime& aTime1, const nsTime& aTime2);
|
||||
friend const PRBool operator >=(const nsTime& aTime1, const nsTime& aTime2);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -154,14 +151,6 @@ operator ==(const nsTime& aTime1, const nsTime& aTime2) {
|
|||
return aTime1.mValue == aTime2.mValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if two times are different
|
||||
*/
|
||||
inline const PRBool
|
||||
operator !=(const nsTime& aTime1, const nsTime& aTime2) {
|
||||
return aTime1.mValue != aTime2.mValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if one time is strictly less than another
|
||||
*/
|
||||
|
@ -170,28 +159,4 @@ operator <(const nsTime& aTime1, const nsTime& aTime2) {
|
|||
return aTime1.mValue < aTime2.mValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if one time is less than or equal to another
|
||||
*/
|
||||
inline const PRBool
|
||||
operator <=(const nsTime& aTime1, const nsTime& aTime2) {
|
||||
return aTime1.mValue <= aTime2.mValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if one time is strictly greater than another
|
||||
*/
|
||||
inline const PRBool
|
||||
operator >(const nsTime& aTime1, const nsTime& aTime2) {
|
||||
return aTime1.mValue > aTime2.mValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if one time is greater than or equal to another
|
||||
*/
|
||||
inline const PRBool
|
||||
operator >=(const nsTime& aTime1, const nsTime& aTime2) {
|
||||
return aTime1.mValue >= aTime2.mValue;
|
||||
}
|
||||
|
||||
#endif // nsTime_h__
|
||||
|
|
Загрузка…
Ссылка в новой задаче