use 'constexpr bool' where possible

This commit is contained in:
conrad
2024-05-21 14:37:31 +10:00
parent f97f3edcb3
commit 67ea132b50
5 changed files with 13 additions and 16 deletions
+4 -7
View File
@@ -286,8 +286,8 @@ accu(const eGlue<T1,T2,eglue_schur>& expr)
typedef typename expr_type::proxy1_type::stored_type P1_stored_type;
typedef typename expr_type::proxy2_type::stored_type P2_stored_type;
const bool have_direct_mem_1 = (is_Mat<P1_stored_type>::value) || (is_subview_col<P1_stored_type>::value);
const bool have_direct_mem_2 = (is_Mat<P2_stored_type>::value) || (is_subview_col<P2_stored_type>::value);
constexpr bool have_direct_mem_1 = (is_Mat<P1_stored_type>::value) || (is_subview_col<P1_stored_type>::value);
constexpr bool have_direct_mem_2 = (is_Mat<P2_stored_type>::value) || (is_subview_col<P2_stored_type>::value);
if(have_direct_mem_1 && have_direct_mem_2)
{
@@ -982,15 +982,12 @@ accu(const SpOp<T1, spop_type>& expr)
typedef typename T1::elem_type eT;
const bool is_vectorise = \
constexpr bool is_vectorise = \
(is_same_type<spop_type, spop_vectorise_row>::yes)
|| (is_same_type<spop_type, spop_vectorise_col>::yes)
|| (is_same_type<spop_type, spop_vectorise_all>::yes);
if(is_vectorise)
{
return accu(expr.m);
}
if(is_vectorise) { return accu(expr.m); }
const SpMat<eT> tmp = expr;
+5 -5
View File
@@ -76,11 +76,11 @@ as_scalar_redirect<2>::apply(const Glue<T1, T2, glue_times>& X)
// T1 must result in a matrix with one row
// T2 must result in a matrix with one column
const bool has_all_mat = (is_Mat<T1>::value || is_Mat_trans<T1>::value) && (is_Mat<T2>::value || is_Mat_trans<T2>::value);
constexpr bool has_all_mat = (is_Mat<T1>::value || is_Mat_trans<T1>::value) && (is_Mat<T2>::value || is_Mat_trans<T2>::value);
const bool use_at = (Proxy<T1>::use_at || Proxy<T2>::use_at);
constexpr bool use_at = (Proxy<T1>::use_at || Proxy<T2>::use_at);
const bool do_partial_unwrap = (has_all_mat || use_at);
constexpr bool do_partial_unwrap = (has_all_mat || use_at);
if(do_partial_unwrap)
{
@@ -140,8 +140,8 @@ as_scalar_redirect<3>::apply(const Glue< Glue<T1, T2, glue_times>, T3, glue_time
const strip_inv <T2> strip1(X.A.B);
const strip_diagmat<T2_stripped_1> strip2(strip1.M);
const bool tmp2_do_inv_gen = strip1.do_inv_gen && arma_config::optimise_invexpr;
const bool tmp2_do_diagmat = strip2.do_diagmat;
constexpr bool tmp2_do_inv_gen = strip1.do_inv_gen && arma_config::optimise_invexpr;
constexpr bool tmp2_do_diagmat = strip2.do_diagmat;
if(tmp2_do_diagmat == false)
{
+1 -1
View File
@@ -216,7 +216,7 @@ op_all::all_vec_helper
uword count = 0;
const bool use_at = (Proxy<T1>::use_at || Proxy<T2>::use_at);
constexpr bool use_at = (Proxy<T1>::use_at || Proxy<T2>::use_at);
if(use_at == false)
{
+1 -1
View File
@@ -206,7 +206,7 @@ op_any::any_vec_helper
arma_conform_assert_same_size(A, B, "relational operator");
const bool use_at = (Proxy<T1>::use_at || Proxy<T2>::use_at);
constexpr bool use_at = (Proxy<T1>::use_at || Proxy<T2>::use_at);
if(use_at == false)
{
+2 -2
View File
@@ -207,9 +207,9 @@ op_dot::apply(const T1& X, const T2& Y)
{
arma_debug_sigprint();
const bool use_at = (Proxy<T1>::use_at) || (Proxy<T2>::use_at);
constexpr bool use_at = (Proxy<T1>::use_at) || (Proxy<T2>::use_at);
const bool have_direct_mem = (quasi_unwrap<T1>::has_orig_mem) && (quasi_unwrap<T2>::has_orig_mem);
constexpr bool have_direct_mem = (quasi_unwrap<T1>::has_orig_mem) && (quasi_unwrap<T2>::has_orig_mem);
if(use_at || have_direct_mem)
{