void unary_operation(VarType type, T (*unaryFunction)(T const &)) {
            auto var = popVariable();
            TypedVariable result(type);

            T value;
            if (type == (VT_DOUBLE)) {
                value = var.getDoubleValue();
            }
            else {
                value = var.getIntValue();
            }
            T resultValue = unaryFunction(value);
            if (type == VT_DOUBLE) {
                result.setDoubleValue(resultValue);
            }
            else {
                result.setIntValue(resultValue);
            }
            pushVariable(result);
        }
示例#2
0
static void
UINT_TO_FLT(State &state, const ControlFlowInst &cf, const AluInst &alu)
{
   unaryFunction(state, cf, alu, "uint");
}
示例#3
0
static void
SQRT(State &state, const ControlFlowInst &cf, const AluInst &alu)
{
   unaryFunction(state, cf, alu, "sqrt");
}
示例#4
0
static void
TRUNC(State &state, const ControlFlowInst &cf, const AluInst &alu)
{
   unaryFunction(state, cf, alu, "trunc");
}
示例#5
0
static void
RECIP(State &state, const ControlFlowInst &cf, const AluInst &alu)
{
   unaryFunction(state, cf, alu, "1 / ");
}
示例#6
0
static void
RNDNE(State &state, const ControlFlowInst &cf, const AluInst &alu)
{
   unaryFunction(state, cf, alu, "roundEven");
}
示例#7
0
static void
LOG(State &state, const ControlFlowInst &cf, const AluInst &alu)
{
   unaryFunction(state, cf, alu, "log2");
}
示例#8
0
static void
FRACT(State &state, const ControlFlowInst &cf, const AluInst &alu)
{
   unaryFunction(state, cf, alu, "fract");
}
示例#9
0
static void
FLOOR(State &state, const ControlFlowInst &cf, const AluInst &alu)
{
   unaryFunction(state, cf, alu, "floor");
}
示例#10
0
static void
EXP(State &state, const ControlFlowInst &cf, const AluInst &alu)
{
   unaryFunction(state, cf, alu, "exp");
}
示例#11
0
static void
CEIL(State &state, const ControlFlowInst &cf, const AluInst &alu)
{
   unaryFunction(state, cf, alu, "ceil");
}