}
QML_V4_END_INSTR(MathCosReal, unaryop)
+ QML_V4_BEGIN_INSTR(MathAbsReal, unaryop)
+ {
+ const Register &src = registers[instr->unaryop.src];
+ Register &output = registers[instr->unaryop.output];
+ if (src.isUndefined()) output.setUndefined();
+ else output.setqreal(qAbs(src.getqreal()));
+ }
+ QML_V4_END_INSTR(MathAbsReal, unaryop)
+
QML_V4_BEGIN_INSTR(MathRoundReal, unaryop)
{
const Register &src = registers[instr->unaryop.src];
}
QML_V4_END_INSTR(MathFloorReal, unaryop)
+ QML_V4_BEGIN_INSTR(MathCeilReal, unaryop)
+ {
+ const Register &src = registers[instr->unaryop.src];
+ Register &output = registers[instr->unaryop.output];
+ if (src.isUndefined()) output.setUndefined();
+ else output.setint(qCeil(src.getqreal()));
+ }
+ QML_V4_END_INSTR(MathCeilReal, unaryop)
+
QML_V4_BEGIN_INSTR(MathPIReal, unaryop)
{
static const qreal qmlPI = 2.0 * qAsin(1.0);
gen(i);
} return;
+ case IR::MathAbsBuiltinFunction: {
+ Instr::MathAbsReal i;
+ i.output = i.src = currentReg;
+ gen(i);
+ } return;
+
case IR::MathRoundBultinFunction: {
Instr::MathRoundReal i;
i.output = i.src = currentReg;
gen(i);
} return;
+ case IR::MathCeilBuiltinFunction: {
+ Instr::MathCeilReal i;
+ i.output = i.src = currentReg;
+ gen(i);
+ } return;
+
case IR::MathPIBuiltinConstant:
break;
} // switch
case V4Instr::MathCosReal:
INSTR_DUMP << "\t" << "MathCosReal" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
break;
+ case V4Instr::MathAbsReal:
+ INSTR_DUMP << "\t" << "MathAbsReal" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
+ break;
case V4Instr::MathRoundReal:
INSTR_DUMP << "\t" << "MathRoundReal" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
break;
case V4Instr::MathFloorReal:
INSTR_DUMP << "\t" << "MathFloorReal" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
break;
+ case V4Instr::MathCeilReal:
+ INSTR_DUMP << "\t" << "MathCeilReal" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
+ break;
case V4Instr::MathPIReal:
INSTR_DUMP << "\t" << "MathPIReal" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
break;
F(ResolveUrl, unaryop) \
F(MathSinReal, unaryop) \
F(MathCosReal, unaryop) \
+ F(MathAbsReal, unaryop) \
F(MathRoundReal, unaryop) \
F(MathFloorReal, unaryop) \
+ F(MathCeilReal, unaryop) \
F(MathPIReal, unaryop) \
F(LoadReal, real_value) \
F(LoadInt, int_value) \
builtin = MathSinBultinFunction;
} else if (id->length() == 8 && *id == QLatin1String("Math.cos")) {
builtin = MathCosBultinFunction;
+ } else if (id->length() == 8 && *id == QLatin1String("Math.abs")) {
+ builtin = MathAbsBuiltinFunction;
} else if (id->length() == 10 && *id == QLatin1String("Math.round")) {
builtin = MathRoundBultinFunction;
} else if (id->length() == 10 && *id == QLatin1String("Math.floor")) {
builtin = MathFloorBultinFunction;
+ } else if (id->length() == 9 && *id == QLatin1String("Math.ceil")) {
+ builtin = MathCeilBuiltinFunction;
} else if (id->length() == 7 && *id == QLatin1String("Math.PI")) {
builtin = MathPIBuiltinConstant;
this->type = RealType;
switch (name->builtin) {
case MathSinBultinFunction:
case MathCosBultinFunction:
+ case MathAbsBuiltinFunction: //### type could also be Int if input was Int
return RealType;
case MathRoundBultinFunction:
case MathFloorBultinFunction:
+ case MathCeilBuiltinFunction:
return IntType;
case NoBuiltinSymbol:
MathCosBultinFunction,
MathRoundBultinFunction,
MathFloorBultinFunction,
+ MathCeilBuiltinFunction,
+ MathAbsBuiltinFunction,
MathPIBuiltinConstant
};