提交 7459c97d authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

SeqManager: Don't use references to pass integers

上级 4b376672
...@@ -16,12 +16,12 @@ namespace RTC ...@@ -16,12 +16,12 @@ namespace RTC
public: public:
struct SeqLowerThan struct SeqLowerThan
{ {
bool operator()(const T& lhs, const T& rhs) const; bool operator()(const T lhs, const T rhs) const;
}; };
struct SeqHigherThan struct SeqHigherThan
{ {
bool operator()(const T& lhs, const T& rhs) const; bool operator()(const T lhs, const T rhs) const;
}; };
private: private:
...@@ -29,8 +29,8 @@ namespace RTC ...@@ -29,8 +29,8 @@ namespace RTC
static const SeqHigherThan isSeqHigherThan; static const SeqHigherThan isSeqHigherThan;
public: public:
static bool IsSeqLowerThan(const T& lhs, const T& rhs); static bool IsSeqLowerThan(const T lhs, const T rhs);
static bool IsSeqHigherThan(const T& lhs, const T& rhs); static bool IsSeqHigherThan(const T lhs, const T rhs);
public: public:
SeqManager(); SeqManager();
......
...@@ -7,14 +7,14 @@ ...@@ -7,14 +7,14 @@
namespace RTC namespace RTC
{ {
template<typename T> template<typename T>
bool SeqManager<T>::SeqLowerThan::operator()(const T& lhs, const T& rhs) const bool SeqManager<T>::SeqLowerThan::operator()(const T lhs, const T rhs) const
{ {
return ((rhs > lhs) && (rhs - lhs <= MaxValue / 2)) || return ((rhs > lhs) && (rhs - lhs <= MaxValue / 2)) ||
((lhs > rhs) && (lhs - rhs > MaxValue / 2)); ((lhs > rhs) && (lhs - rhs > MaxValue / 2));
} }
template<typename T> template<typename T>
bool SeqManager<T>::SeqHigherThan::operator()(const T& lhs, const T& rhs) const bool SeqManager<T>::SeqHigherThan::operator()(const T lhs, const T rhs) const
{ {
return ((lhs > rhs) && (lhs - rhs <= MaxValue / 2)) || return ((lhs > rhs) && (lhs - rhs <= MaxValue / 2)) ||
((rhs > lhs) && (rhs - lhs > MaxValue / 2)); ((rhs > lhs) && (rhs - lhs > MaxValue / 2));
...@@ -27,13 +27,13 @@ namespace RTC ...@@ -27,13 +27,13 @@ namespace RTC
const typename SeqManager<T>::SeqHigherThan SeqManager<T>::isSeqHigherThan; const typename SeqManager<T>::SeqHigherThan SeqManager<T>::isSeqHigherThan;
template<typename T> template<typename T>
bool SeqManager<T>::IsSeqLowerThan(const T& lhs, const T& rhs) bool SeqManager<T>::IsSeqLowerThan(const T lhs, const T rhs)
{ {
return isSeqLowerThan(lhs, rhs); return isSeqLowerThan(lhs, rhs);
} }
template<typename T> template<typename T>
bool SeqManager<T>::IsSeqHigherThan(const T& lhs, const T& rhs) bool SeqManager<T>::IsSeqHigherThan(const T lhs, const T rhs)
{ {
return isSeqHigherThan(lhs, rhs); return isSeqHigherThan(lhs, rhs);
} }
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论