From d21c9b08803a79e020f4e20a9d1adb3faf13d85a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Fri, 12 Jun 2020 13:49:32 +0200 Subject: [PATCH] [poincare] Expression: clean magic numbers --- poincare/src/expression.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/poincare/src/expression.cpp b/poincare/src/expression.cpp index c6f444236..1fb8778c4 100644 --- a/poincare/src/expression.cpp +++ b/poincare/src/expression.cpp @@ -126,7 +126,7 @@ bool Expression::deepIsMatrix(Context * context) const { } // Scalar expressions ExpressionNode::Type types1[] = {ExpressionNode::Type::BinomialCoefficient, ExpressionNode::Type::Derivative, ExpressionNode::Type::Determinant, ExpressionNode::Type::DivisionQuotient, ExpressionNode::Type::DivisionRemainder, ExpressionNode::Type::Factor, ExpressionNode::Type::GreatCommonDivisor, ExpressionNode::Type::Integral, ExpressionNode::Type::LeastCommonMultiple, ExpressionNode::Type::MatrixTrace, ExpressionNode::Type::NthRoot, ExpressionNode::Type::PermuteCoefficient, ExpressionNode::Type::Randint, ExpressionNode::Type::Round, ExpressionNode::Type::SignFunction, ExpressionNode::Type::SquareRoot}; - if (isOfType(types1, 16)) { + if (isOfType(types1, sizeof(types1)/sizeof(ExpressionNode::Type))) { return false; } // The children were sorted so any expression which is a matrix (deeply) would be at the end @@ -137,7 +137,7 @@ bool Expression::deepIsMatrix(Context * context) const { } // Logarithm, Power, Product, Sum are matrices only if their first child is a matrix ExpressionNode::Type types2[] = {ExpressionNode::Type::Logarithm, ExpressionNode::Type::Power, ExpressionNode::Type::Product, ExpressionNode::Type::Sum}; - if (isOfType(types2, 4)) { + if (isOfType(types2, sizeof(types2)/sizeof(ExpressionNode::Type))) { assert(numberOfChildren() > 0); return childAtIndex(0).deepIsMatrix(context); }