use float -> float math functions
double foo(double) --> float foof(float) If you prefer, I think std::foo would work too. Rename src to field to match the new macro. Change-Id: I61ca11d6bc1fc8cb90004b72429b3941007cd5d8 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/215143 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
parent
d2f2c04e7e
commit
459aed1e29
@ -235,55 +235,55 @@ void Interpreter::disassemble(const ByteCodeFunction& f) {
|
||||
}
|
||||
}
|
||||
|
||||
#define VECTOR_BINARY_OP(base, src, op) \
|
||||
#define VECTOR_BINARY_OP(base, field, op) \
|
||||
case ByteCodeInstruction::base ## 4: \
|
||||
sp[-4] = sp[-4].src op sp[0].src; \
|
||||
sp[-4] = sp[-4].field op sp[0].field; \
|
||||
POP(); \
|
||||
/* fall through */ \
|
||||
case ByteCodeInstruction::base ## 3: { \
|
||||
int count = (int) ByteCodeInstruction::base - (int) inst - 1; \
|
||||
sp[count] = sp[count].src op sp[0].src; \
|
||||
sp[count] = sp[count].field op sp[0].field; \
|
||||
POP(); \
|
||||
} /* fall through */ \
|
||||
case ByteCodeInstruction::base ## 2: { \
|
||||
int count = (int) ByteCodeInstruction::base - (int) inst - 1; \
|
||||
sp[count] = sp[count].src op sp[0].src; \
|
||||
sp[count] = sp[count].field op sp[0].field; \
|
||||
POP(); \
|
||||
} /* fall through */ \
|
||||
case ByteCodeInstruction::base: { \
|
||||
int count = (int) ByteCodeInstruction::base - (int) inst - 1; \
|
||||
sp[count] = sp[count].src op sp[0].src; \
|
||||
sp[count] = sp[count].field op sp[0].field; \
|
||||
POP(); \
|
||||
break; \
|
||||
}
|
||||
|
||||
#define VECTOR_BINARY_FN(base, src, fn) \
|
||||
#define VECTOR_BINARY_FN(base, field, fn) \
|
||||
case ByteCodeInstruction::base ## 4: \
|
||||
sp[-4] = fn(sp[-4].src, sp[0].src); \
|
||||
sp[-4] = fn(sp[-4].field, sp[0].field); \
|
||||
POP(); \
|
||||
/* fall through */ \
|
||||
case ByteCodeInstruction::base ## 3: { \
|
||||
int count = (int) ByteCodeInstruction::base - (int) inst - 1; \
|
||||
sp[count] = fn(sp[count].src, sp[0].src); \
|
||||
sp[count] = fn(sp[count].field, sp[0].field); \
|
||||
POP(); \
|
||||
} /* fall through */ \
|
||||
case ByteCodeInstruction::base ## 2: { \
|
||||
int count = (int) ByteCodeInstruction::base - (int) inst - 1; \
|
||||
sp[count] = fn(sp[count].src, sp[0].src); \
|
||||
sp[count] = fn(sp[count].field, sp[0].field); \
|
||||
POP(); \
|
||||
} /* fall through */ \
|
||||
case ByteCodeInstruction::base: { \
|
||||
int count = (int) ByteCodeInstruction::base - (int) inst - 1; \
|
||||
sp[count] = fn(sp[count].src, sp[0].src); \
|
||||
sp[count] = fn(sp[count].field, sp[0].field); \
|
||||
POP(); \
|
||||
break; \
|
||||
}
|
||||
|
||||
#define VECTOR_UNARY_FN(base, fn, field) \
|
||||
case ByteCodeInstruction::base ## 4: sp[-3].field = fn(sp[-3].field); \
|
||||
case ByteCodeInstruction::base ## 3: sp[-2].field = fn(sp[-2].field); \
|
||||
case ByteCodeInstruction::base ## 2: sp[-1].field = fn(sp[-1].field); \
|
||||
case ByteCodeInstruction::base: sp[ 0].field = fn(sp[ 0].field); \
|
||||
#define VECTOR_UNARY_FN(base, fn, field) \
|
||||
case ByteCodeInstruction::base ## 4: sp[-3] = fn(sp[-3].field); \
|
||||
case ByteCodeInstruction::base ## 3: sp[-2] = fn(sp[-2].field); \
|
||||
case ByteCodeInstruction::base ## 2: sp[-1] = fn(sp[-1].field); \
|
||||
case ByteCodeInstruction::base: sp[ 0] = fn(sp[ 0].field); \
|
||||
break;
|
||||
|
||||
struct StackFrame {
|
||||
@ -386,7 +386,7 @@ void Interpreter::innerRun(const ByteCodeFunction& f, Value* stack, Value* outRe
|
||||
case ByteCodeInstruction::kConvertUtoF : sp[ 0].fFloat = sp[ 0].fUnsigned;
|
||||
break;
|
||||
|
||||
VECTOR_UNARY_FN(kCos, cos, fFloat)
|
||||
VECTOR_UNARY_FN(kCos, cosf, fFloat)
|
||||
|
||||
case ByteCodeInstruction::kDebugPrint: {
|
||||
Value v = POP();
|
||||
@ -508,8 +508,8 @@ void Interpreter::innerRun(const ByteCodeFunction& f, Value* stack, Value* outRe
|
||||
}
|
||||
}
|
||||
|
||||
VECTOR_UNARY_FN(kSin, sin, fFloat)
|
||||
VECTOR_UNARY_FN(kSqrt, sqrt, fFloat)
|
||||
VECTOR_UNARY_FN(kSin, sinf, fFloat)
|
||||
VECTOR_UNARY_FN(kSqrt, sqrtf, fFloat)
|
||||
|
||||
case ByteCodeInstruction::kStore4: stack[*ip + 3] = POP();
|
||||
case ByteCodeInstruction::kStore3: stack[*ip + 2] = POP();
|
||||
@ -559,7 +559,7 @@ void Interpreter::innerRun(const ByteCodeFunction& f, Value* stack, Value* outRe
|
||||
break;
|
||||
}
|
||||
|
||||
VECTOR_UNARY_FN(kTan, tan, fFloat)
|
||||
VECTOR_UNARY_FN(kTan, tanf, fFloat)
|
||||
|
||||
case ByteCodeInstruction::kWriteExternal: // fall through
|
||||
case ByteCodeInstruction::kWriteExternal2: // fall through
|
||||
|
Loading…
Reference in New Issue
Block a user