aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/jumper/SkJumper_vectors.h
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2017-04-27 08:59:55 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-27 15:30:07 +0000
commitb4bbc64adee74f99ddfc30ad4e5043f98380bdbb (patch)
treecf5ffc26961271454629a7cc078e9cf0b6ca31c2 /src/jumper/SkJumper_vectors.h
parente51125557f28c2fc3dfbf4a8553a7c06bc1a0286 (diff)
clear out C(), _i, and _f constants from SkJumper_vectors.h
I think this is just gonna be a bunch of baby steps for now. This gets everything in SkJumper_vectors.h. CQ_INCLUDE_TRYBOTS=skia.primary:Test-Win7-MSVC-Golo-CPU-AVX-x86_64-Release,Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release,Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-SK_CPU_LIMIT_SSE41,Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-SK_CPU_LIMIT_SSE2 Change-Id: Ic87faa9bf6380a4fc9a577936dad8c3a9c48472e Reviewed-on: https://skia-review.googlesource.com/14441 Commit-Queue: Mike Klein <mtklein@google.com> Reviewed-by: Herb Derby <herb@google.com>
Diffstat (limited to 'src/jumper/SkJumper_vectors.h')
-rw-r--r--src/jumper/SkJumper_vectors.h34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/jumper/SkJumper_vectors.h b/src/jumper/SkJumper_vectors.h
index 57f36be0dd..504aca0a82 100644
--- a/src/jumper/SkJumper_vectors.h
+++ b/src/jumper/SkJumper_vectors.h
@@ -162,7 +162,7 @@
SI F floor_(F v) {
F roundtrip = vcvt_f32_s32(vcvt_s32_f32(v));
- return roundtrip - if_then_else(roundtrip > v, 1.0_f, 0);
+ return roundtrip - if_then_else(roundtrip > v, 1, 0);
}
template <typename T>
@@ -467,7 +467,7 @@
return _mm_floor_ps(v);
#else
F roundtrip = _mm_cvtepi32_ps(_mm_cvttps_epi32(v));
- return roundtrip - if_then_else(roundtrip > v, 1.0_f, 0);
+ return roundtrip - if_then_else(roundtrip > v, 1, 0);
#endif
}
@@ -576,21 +576,21 @@ SI F fract(F v) { return v - floor_(v); }
// See http://www.machinedlearnings.com/2011/06/fast-approximate-logarithm-exponential.html.
SI F approx_log2(F x) {
// e - 127 is a fair approximation of log2(x) in its own right...
- F e = cast(bit_cast<U32>(x)) * C(1.0f / (1<<23));
+ F e = cast(bit_cast<U32>(x)) * (1.0f / (1<<23));
// ... but using the mantissa to refine its error is _much_ better.
- F m = bit_cast<F>((bit_cast<U32>(x) & 0x007fffff_i) | 0x3f000000_i);
+ F m = bit_cast<F>((bit_cast<U32>(x) & 0x007fffff) | 0x3f000000);
return e
- - 124.225514990_f
- - 1.498030302_f * m
- - 1.725879990_f / (0.3520887068_f + m);
+ - 124.225514990f
+ - 1.498030302f * m
+ - 1.725879990f / (0.3520887068f + m);
}
SI F approx_pow2(F x) {
F f = fract(x);
- return bit_cast<F>(round(C(1.0f * (1<<23)),
- x + 121.274057500_f
- - 1.490129070_f * f
- + 27.728023300_f / (4.84252568_f - f)));
+ return bit_cast<F>(round(1.0f * (1<<23),
+ x + 121.274057500f
+ - 1.490129070f * f
+ + 27.728023300f / (4.84252568f - f)));
}
SI F approx_powf(F x, F y) {
@@ -611,13 +611,13 @@ SI F from_half(U16 h) {
#else
// Remember, a half is 1-5-10 (sign-exponent-mantissa) with 15 exponent bias.
U32 sem = expand(h),
- s = sem & 0x8000_i,
+ s = sem & 0x8000,
em = sem ^ s;
// Convert to 1-8-23 float with 127 bias, flushing denorm halfs (including zero) to zero.
- auto denorm = (I32)em < 0x0400_i; // I32 comparison is often quicker, and always safe here.
+ auto denorm = (I32)em < 0x0400; // I32 comparison is often quicker, and always safe here.
return if_then_else(denorm, F(0)
- , bit_cast<F>( (s<<16) + (em<<13) + C((127-15)<<23) ));
+ , bit_cast<F>( (s<<16) + (em<<13) + ((127-15)<<23) ));
#endif
}
@@ -636,13 +636,13 @@ SI U16 to_half(F f) {
#else
// Remember, a float is 1-8-23 (sign-exponent-mantissa) with 127 exponent bias.
U32 sem = bit_cast<U32>(f),
- s = sem & 0x80000000_i,
+ s = sem & 0x80000000,
em = sem ^ s;
// Convert to 1-5-10 half with 15 bias, flushing denorm halfs (including zero) to zero.
- auto denorm = (I32)em < 0x38800000_i; // I32 comparison is often quicker, and always safe here.
+ auto denorm = (I32)em < 0x38800000; // I32 comparison is often quicker, and always safe here.
return pack(if_then_else(denorm, U32(0)
- , (s>>16) + (em>>13) - C((127-15)<<10)));
+ , (s>>16) + (em>>13) - ((127-15)<<10)));
#endif
}