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>
diff --git a/src/sksl/SkSLInterpreter.cpp b/src/sksl/SkSLInterpreter.cpp
index 9118c97..9e28445 100644
--- a/src/sksl/SkSLInterpreter.cpp
+++ b/src/sksl/SkSLInterpreter.cpp
@@ -235,55 +235,55 @@
}
}
-#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 @@
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 @@
}
}
- 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 @@
break;
}
- VECTOR_UNARY_FN(kTan, tan, fFloat)
+ VECTOR_UNARY_FN(kTan, tanf, fFloat)
case ByteCodeInstruction::kWriteExternal: // fall through
case ByteCodeInstruction::kWriteExternal2: // fall through