Пример #1
0
void executeExponentialIntInt(Executer &executer)
{
    auto y = executer.topInt();
    executer.pop();
    auto x = executer.topInt();
    executer.setTop(PowerIntInt{executer, x, y}());
}
Пример #2
0
void executeSubtractIntInt(Executer &executer)
{
    auto rhs = executer.topInt();
    executer.pop();
    auto result = int64_t{executer.topInt()};
    result -= rhs;
    checkIntegerOverflow(executer, result);
    executer.setTopIntFromInt64(result);
}
Пример #3
0
inline int32_t popIntegerDivisor(Executer &executer)
{
    auto rhs = executer.topInt();
    checkDivideByZero(executer, rhs);
    executer.pop();
    return rhs;
}
Пример #4
0
void executeRndInt(Executer &executer)
{
    auto argument = executer.topInt();
    if (argument <= 0) {
        throw RunError {"random function on zero or negative number", executer.currentOffset()};
    }
    executer.setTop(executer.getRandomNumber(argument));
}
Пример #5
0
void executeAbsInt(Executer &executer)
{
    auto argument = executer.topInt();
    if (argument < 0) {
        checkNegativeIntegerOverflow(executer, argument);
        executer.setTop(-argument);
    }
}
Пример #6
0
void executeImp(Executer &executer)
{
    auto rhs = executer.topInt();
    executer.pop();
    executer.setTop(~executer.topInt() | rhs);
}
Пример #7
0
void executeEqv(Executer &executer)
{
    auto rhs = executer.topInt();
    executer.pop();
    executer.setTop(~(executer.topInt() ^ rhs));
}
Пример #8
0
void executeXor(Executer &executer)
{
    auto rhs = executer.topInt();
    executer.pop();
    executer.setTop(executer.topInt() ^ rhs);
}
Пример #9
0
void executeAnd(Executer &executer)
{
    auto rhs = executer.topInt();
    executer.pop();
    executer.setTop(executer.topInt() & rhs);
}
Пример #10
0
void executeModuloIntInt(Executer &executer)
{
    auto rhs = popIntegerDivisor(executer);
    executer.setTop(executer.topInt() % rhs);
}
Пример #11
0
void executeDivideIntInt(Executer &executer)
{
    auto rhs = popIntegerDivisor(executer);
    executer.setTop(executer.topInt() / rhs);
}
Пример #12
0
void executeNegateInt(Executer &executer)
{
    auto operand = executer.topInt();
    checkNegativeIntegerOverflow(executer, operand);
    executer.setTop(-operand);
}