removed shift functions with explicit number of bits

This commit is contained in:
Joe Crop
2022-12-26 22:01:11 -08:00
parent 81dc1bd806
commit d7f54ad644
9 changed files with 0 additions and 71 deletions

View File

@@ -86,8 +86,6 @@ const ToolboxMessageTree vectorsChildren[] = {
const ToolboxMessageTree logicExplicitChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::LogicalNotExplicitCommandWithArg, I18n::Message::LogicalNot),
ToolboxMessageTree::Leaf(I18n::Message::LogicalShiftLeftExplicitCommandWithArg, I18n::Message::LogicalShiftLeft),
ToolboxMessageTree::Leaf(I18n::Message::LogicalShiftRightExplicitCommandWithArg, I18n::Message::LogicalShiftRight),
ToolboxMessageTree::Leaf(I18n::Message::LogicalShiftRightArithmeticExplicitCommandWithArg, I18n::Message::LogicalShiftRightArithmetic),
ToolboxMessageTree::Leaf(I18n::Message::LogicalRotateLeftExplicitCommandWithArg, I18n::Message::LogicalRotateLeft),
ToolboxMessageTree::Leaf(I18n::Message::LogicalRotateRightExplicitCommandWithArg, I18n::Message::LogicalRotateRight),

View File

@@ -499,11 +499,9 @@ LogicalNotExplicitCommandWithArg = "not(a,n)"
LogicalOr = "a OR b"
LogicalOrCommandWithArg = "or(a,b)"
LogicalShiftLeftCommandWithArg = "sll(a,s)"
LogicalShiftLeftExplicitCommandWithArg = "sll(a,s,n)"
LogicalShiftRightArithmeticCommandWithArg = "sra(a,s)"
LogicalShiftRightArithmeticExplicitCommandWithArg = "sra(a,s,n)"
LogicalShiftRightCommandWithArg = "srl(a,s)"
LogicalShiftRightExplicitCommandWithArg = "srl(a,s,n)"
LogicalRotateLeftCommandWithArg = "rol(a,r)"
LogicalRotateLeftExplicitCommandWithArg = "rol(a,r,n)"
LogicalRotateRightCommandWithArg = "ror(a,r)"

View File

@@ -140,13 +140,6 @@ namespace Poincare
Expression shallowReduce(ExpressionNode::ReductionContext reductionContext);
};
class ShiftLogicLeftExplicit final : public Expression {
public:
ShiftLogicLeftExplicit(const BinaryOperationNode<22> *n) : Expression(n) {}
static ShiftLogicLeftExplicit Builder(Expression child1, Expression child2, Expression child3) { return TreeHandle::FixedArityBuilder<ShiftLogicLeftExplicit, BinaryOperationNode<22> >({child1, child2, child3}); }
static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("sll", 3, &UntypedBuilderThreeChildren<ShiftLogicLeftExplicit>);
Expression shallowReduce(ExpressionNode::ReductionContext reductionContext);
};
class ShiftLogicRight final : public Expression {
public:
@@ -156,14 +149,6 @@ namespace Poincare
Expression shallowReduce(ExpressionNode::ReductionContext reductionContext);
};
class ShiftLogicRightExplicit final : public Expression {
public:
ShiftLogicRightExplicit(const BinaryOperationNode<24> *n) : Expression(n) {}
static ShiftLogicRightExplicit Builder(Expression child1, Expression child2, Expression child3) { return TreeHandle::FixedArityBuilder<ShiftLogicRightExplicit, BinaryOperationNode<24> >({child1, child2, child3}); }
static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("srl", 3, &UntypedBuilderThreeChildren<ShiftLogicRightExplicit>);
Expression shallowReduce(ExpressionNode::ReductionContext reductionContext);
};
class ShiftArithmeticRight final : public Expression {
public:
ShiftArithmeticRight(const BinaryOperationNode<25> *n) : Expression(n) {}

View File

@@ -108,9 +108,7 @@ class Expression : public TreeHandle {
friend class ShiftArithmeticRight;
friend class ShiftArithmeticRightExplicit;
friend class ShiftLogicLeft;
friend class ShiftLogicLeftExplicit;
friend class ShiftLogicRight;
friend class ShiftLogicRightExplicit;
friend class SignFunction;
friend class Sine;
friend class SquareRoot;

View File

@@ -115,9 +115,7 @@ public:
ShiftArithmeticRight,
ShiftArithmeticRightExplicit,
ShiftLogicLeft,
ShiftLogicLeftExplicit,
ShiftLogicRight,
ShiftLogicRightExplicit,
SignFunction,
SquareRoot,
Subtraction,

View File

@@ -20,9 +20,7 @@ namespace Poincare {
constexpr Expression::FunctionHelper BitsClear::s_functionHelper;
constexpr Expression::FunctionHelper BitsClearExplicit::s_functionHelper;
constexpr Expression::FunctionHelper ShiftLogicLeft::s_functionHelper;
constexpr Expression::FunctionHelper ShiftLogicLeftExplicit::s_functionHelper;
constexpr Expression::FunctionHelper ShiftLogicRight::s_functionHelper;
constexpr Expression::FunctionHelper ShiftLogicRightExplicit::s_functionHelper;
constexpr Expression::FunctionHelper ShiftArithmeticRight::s_functionHelper;
constexpr Expression::FunctionHelper ShiftArithmeticRightExplicit::s_functionHelper;
constexpr Expression::FunctionHelper RotateLeft::s_functionHelper;
@@ -44,9 +42,7 @@ namespace Poincare {
template<> int BinaryOperationNode<19>::numberOfChildren() const { return BitsClear::s_functionHelper.numberOfChildren(); }
template<> int BinaryOperationNode<20>::numberOfChildren() const { return BitsClearExplicit::s_functionHelper.numberOfChildren(); }
template<> int BinaryOperationNode<21>::numberOfChildren() const { return ShiftLogicLeft::s_functionHelper.numberOfChildren(); }
template<> int BinaryOperationNode<22>::numberOfChildren() const { return ShiftLogicLeftExplicit::s_functionHelper.numberOfChildren(); }
template<> int BinaryOperationNode<23>::numberOfChildren() const { return ShiftLogicRight::s_functionHelper.numberOfChildren(); }
template<> int BinaryOperationNode<24>::numberOfChildren() const { return ShiftLogicRightExplicit::s_functionHelper.numberOfChildren(); }
template<> int BinaryOperationNode<25>::numberOfChildren() const { return ShiftArithmeticRight::s_functionHelper.numberOfChildren(); }
template<> int BinaryOperationNode<26>::numberOfChildren() const { return ShiftArithmeticRightExplicit::s_functionHelper.numberOfChildren(); }
template<> int BinaryOperationNode<27>::numberOfChildren() const { return RotateLeft::s_functionHelper.numberOfChildren(); }
@@ -116,21 +112,11 @@ namespace Poincare {
return LayoutHelper::Prefix(this, floatDisplayMode, numberOfSignificantDigits, ShiftLogicLeft::s_functionHelper.name());
}
template<>
Layout BinaryOperationNode<22>::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
return LayoutHelper::Prefix(this, floatDisplayMode, numberOfSignificantDigits, ShiftLogicLeftExplicit::s_functionHelper.name());
}
template<>
Layout BinaryOperationNode<23>::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
return LayoutHelper::Prefix(this, floatDisplayMode, numberOfSignificantDigits, ShiftLogicRight::s_functionHelper.name());
}
template<>
Layout BinaryOperationNode<24>::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
return LayoutHelper::Prefix(this, floatDisplayMode, numberOfSignificantDigits, ShiftLogicRightExplicit::s_functionHelper.name());
}
template<>
Layout BinaryOperationNode<25>::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
return LayoutHelper::Prefix(this, floatDisplayMode, numberOfSignificantDigits, ShiftArithmeticRight::s_functionHelper.name());
@@ -182,9 +168,7 @@ namespace Poincare {
T == 27 ? RotateLeft::s_functionHelper.name() :
T == 26 ? ShiftArithmeticRightExplicit::s_functionHelper.name() :
T == 25 ? ShiftArithmeticRight::s_functionHelper.name() :
T == 24 ? ShiftLogicRightExplicit::s_functionHelper.name() :
T == 23 ? ShiftLogicRight::s_functionHelper.name() :
T == 22 ? ShiftLogicLeftExplicit::s_functionHelper.name() :
T == 21 ? ShiftLogicLeft::s_functionHelper.name() :
T == 20 ? BitsClearExplicit::s_functionHelper.name() :
T == 19 ? BitsClear::s_functionHelper.name() :
@@ -260,21 +244,11 @@ namespace Poincare {
return ShiftLogicLeft(this).shallowReduce(reductionContext);
}
template<>
Expression BinaryOperationNode<22>::shallowReduce(ExpressionNode::ReductionContext reductionContext) {
return ShiftLogicLeftExplicit(this).shallowReduce(reductionContext);
}
template<>
Expression BinaryOperationNode<23>::shallowReduce(ExpressionNode::ReductionContext reductionContext) {
return ShiftLogicRight(this).shallowReduce(reductionContext);
}
template<>
Expression BinaryOperationNode<24>::shallowReduce(ExpressionNode::ReductionContext reductionContext) {
return ShiftLogicRightExplicit(this).shallowReduce(reductionContext);
}
template<>
Expression BinaryOperationNode<25>::shallowReduce(ExpressionNode::ReductionContext reductionContext) {
return ShiftArithmeticRight(this).shallowReduce(reductionContext);
@@ -365,8 +339,6 @@ namespace Poincare {
switch(t) {
case ExpressionNode::Type::BitsClearExplicit:
case ExpressionNode::Type::ShiftLogicLeftExplicit:
case ExpressionNode::Type::ShiftLogicRightExplicit:
case ExpressionNode::Type::ShiftArithmeticRightExplicit:
case ExpressionNode::Type::RotateLeftExplicit:
case ExpressionNode::Type::RotateRightExplicit:
@@ -416,15 +388,9 @@ namespace Poincare {
case ExpressionNode::Type::ShiftLogicLeft:
x = Integer::LogicalShift(aq, bq);
break;
case ExpressionNode::Type::ShiftLogicLeftExplicit:
x = Integer::LogicalShift(aq, bq, cq);
break;
case ExpressionNode::Type::ShiftLogicRight:
x = Integer::LogicalShift(aq, bq_neg);
break;
case ExpressionNode::Type::ShiftLogicRightExplicit:
x = Integer::LogicalShift(aq, bq_neg, cq);
break;
case ExpressionNode::Type::ShiftArithmeticRight:
x = Integer::LogicalShiftRightArithmetic(aq, bq);
break;
@@ -505,18 +471,10 @@ namespace Poincare {
return BinaryOperation::shallowReduceDirect(*this, ExpressionNode::Type::ShiftLogicLeft, reductionContext);
}
Expression ShiftLogicLeftExplicit::shallowReduce(ExpressionNode::ReductionContext reductionContext) {
return BinaryOperation::shallowReduceDirect(*this, ExpressionNode::Type::ShiftLogicLeftExplicit, reductionContext);
}
Expression ShiftLogicRight::shallowReduce(ExpressionNode::ReductionContext reductionContext) {
return BinaryOperation::shallowReduceDirect(*this, ExpressionNode::Type::ShiftLogicRight, reductionContext);
}
Expression ShiftLogicRightExplicit::shallowReduce(ExpressionNode::ReductionContext reductionContext) {
return BinaryOperation::shallowReduceDirect(*this, ExpressionNode::Type::ShiftLogicRightExplicit, reductionContext);
}
Expression ShiftArithmeticRight::shallowReduce(ExpressionNode::ReductionContext reductionContext) {
return BinaryOperation::shallowReduceDirect(*this, ExpressionNode::Type::ShiftArithmeticRight, reductionContext);
}

View File

@@ -167,11 +167,9 @@ private:
&Sine::s_functionHelper,
&HyperbolicSine::s_functionHelper,
&ShiftLogicLeft::s_functionHelper,
&ShiftLogicLeftExplicit::s_functionHelper,
&ShiftArithmeticRight::s_functionHelper,
&ShiftArithmeticRightExplicit::s_functionHelper,
&ShiftLogicRight::s_functionHelper,
&ShiftLogicRightExplicit::s_functionHelper,
&Sum::s_functionHelper,
&Tangent::s_functionHelper,
&HyperbolicTangent::s_functionHelper,

View File

@@ -377,9 +377,7 @@ template Round TreeHandle::FixedArityBuilder<Round, RoundNode>(const Tuple &);
template ShiftArithmeticRight TreeHandle::FixedArityBuilder<ShiftArithmeticRight, BinaryOperationNode<25> >(const Tuple &);
template ShiftArithmeticRightExplicit TreeHandle::FixedArityBuilder<ShiftArithmeticRightExplicit, BinaryOperationNode<26> >(const Tuple &);
template ShiftLogicLeft TreeHandle::FixedArityBuilder<ShiftLogicLeft, BinaryOperationNode<21> >(const Tuple &);
template ShiftLogicLeftExplicit TreeHandle::FixedArityBuilder<ShiftLogicLeftExplicit, BinaryOperationNode<22> >(const Tuple &);
template ShiftLogicRight TreeHandle::FixedArityBuilder<ShiftLogicRight, BinaryOperationNode<23> >(const Tuple &);
template ShiftLogicRightExplicit TreeHandle::FixedArityBuilder<ShiftLogicRightExplicit, BinaryOperationNode<24> >(const Tuple &);
template SignFunction TreeHandle::FixedArityBuilder<SignFunction, SignFunctionNode>(const Tuple &);
template SimplePredictionInterval TreeHandle::FixedArityBuilder<SimplePredictionInterval, SimplePredictionIntervalNode>(const Tuple &);
template Sine TreeHandle::FixedArityBuilder<Sine, SineNode>(const Tuple &);

View File

@@ -441,9 +441,7 @@ QUIZ_CASE(poincare_parsing_identifiers) {
assert_parsed_expression_is("sra(1,1)", ShiftArithmeticRight::Builder(BasedInteger::Builder(1), BasedInteger::Builder(1)));
assert_parsed_expression_is("sra(1,1,1)", ShiftArithmeticRightExplicit::Builder(BasedInteger::Builder(1), BasedInteger::Builder(1), BasedInteger::Builder(1)));
assert_parsed_expression_is("sll(1,1)", ShiftLogicLeft::Builder(BasedInteger::Builder(1), BasedInteger::Builder(1)));
assert_parsed_expression_is("sll(1,1,1)", ShiftLogicLeftExplicit::Builder(BasedInteger::Builder(1), BasedInteger::Builder(1), BasedInteger::Builder(1)));
assert_parsed_expression_is("srl(1,1)", ShiftLogicRight::Builder(BasedInteger::Builder(1), BasedInteger::Builder(1)));
assert_parsed_expression_is("srl(1,1,1)", ShiftLogicRightExplicit::Builder(BasedInteger::Builder(1), BasedInteger::Builder(1), BasedInteger::Builder(1)));
assert_parsed_expression_is("tc(1,1)", TwosComplement::Builder(BasedInteger::Builder(1), BasedInteger::Builder(1)));
}