Dynare++: add a few parentheses to make GCC happy with -Wparentheses
I’m not sure that the intent for the hash function was actually what is currently in the code, but it’s not worth improving this given that we want to get rid of Dynare++ and the performance impact is probably negligible.mr#2067
parent
5db070e9dd
commit
b7c70fd99e
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright © 2005-2011 Ondra Kamenik
|
||||
* Copyright © 2019 Dynare Team
|
||||
* Copyright © 2019-2022 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
|
@ -85,8 +85,8 @@ namespace ogp
|
|||
operator<(const Operation &op) const
|
||||
{
|
||||
return (code < op.code
|
||||
|| code == op.code
|
||||
&& (op1 < op.op1 || op1 == op.op1 && op2 < op.op2));
|
||||
|| (code == op.code
|
||||
&& (op1 < op.op1 || (op1 == op.op1 && op2 < op.op2))));
|
||||
}
|
||||
/** Returns a number of operands. */
|
||||
int
|
||||
|
@ -98,7 +98,7 @@ namespace ogp
|
|||
size_t
|
||||
hashval() const
|
||||
{
|
||||
return op2+1 + (op1+1)^15 + static_cast<int>(code)^30;
|
||||
return (op2+1 + op1+1)^(15 + static_cast<int>(code))^30;
|
||||
}
|
||||
|
||||
code_t
|
||||
|
|
|
@ -52,8 +52,8 @@ Vector::operator=(const Vector &v)
|
|||
throw SYLV_MES_EXCEPTION("Attempt to assign vectors with different lengths.");
|
||||
|
||||
if (s == v.s
|
||||
&& (data <= v.data && v.data < data+len*s
|
||||
|| v.data <= data && data < v.data+v.len*v.s)
|
||||
&& ((data <= v.data && v.data < data+len*s)
|
||||
|| (v.data <= data && data < v.data+v.len*v.s))
|
||||
&& (data-v.data) % s == 0)
|
||||
throw SYLV_MES_EXCEPTION("Attempt to assign overlapping vectors.");
|
||||
|
||||
|
@ -67,8 +67,8 @@ Vector::operator=(const ConstVector &v)
|
|||
if (v.len != len)
|
||||
throw SYLV_MES_EXCEPTION("Attempt to assign vectors with different lengths.");
|
||||
if (s == v.s
|
||||
&& (data <= v.data && v.data < data+len*s
|
||||
|| v.data <= data && data < v.data+v.len*v.s)
|
||||
&& ((data <= v.data && v.data < data+len*s)
|
||||
|| (v.data <= data && data < v.data+v.len*v.s))
|
||||
&& (data-v.data) % s == 0)
|
||||
throw SYLV_MES_EXCEPTION("Attempt to assign overlapping vectors.");
|
||||
|
||||
|
|
|
@ -186,8 +186,8 @@ TestRunnable::level_kron(bool trans, const std::string &mname, const std::string
|
|||
MMMatrixIn mmc(cname);
|
||||
|
||||
int length = power(m, depth)*n;
|
||||
if (level > 0 && mmt.row() != m
|
||||
|| level == 0 && mmt.row() != n
|
||||
if ((level > 0 && mmt.row() != m)
|
||||
|| (level == 0 && mmt.row() != n)
|
||||
|| mmv.row() != length
|
||||
|| mmc.row() != length)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue