Remove SkTMin and SkTMax
Use std::min and std::max everywhere.
SkTPin still exists. We can't use std::clamp yet, and even when
we can, it has undefined behavior with NaN. SkTPin is written
to ensure that we return a value in the [lo, hi] range.
Change-Id: I506852a36e024ae405358d5078a872e2c77fa71e
Docs-Preview: https://skia.org/?cl=269357
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269357
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/tests/SkNxTest.cpp b/tests/SkNxTest.cpp
index b6b0085..0f189df 100644
--- a/tests/SkNxTest.cpp
+++ b/tests/SkNxTest.cpp
@@ -133,7 +133,7 @@
for (int a = 0; a < (1<<8); a++) {
for (int b = 0; b < (1<<8); b++) {
Sk16b aw(a), bw(b);
- REPORTER_ASSERT(r, Sk16b::Min(aw, bw)[0] == SkTMin(a, b));
+ REPORTER_ASSERT(r, Sk16b::Min(aw, bw)[0] == std::min(a, b));
REPORTER_ASSERT(r, !(aw < bw)[0] == !(a < b));
}}
@@ -143,12 +143,12 @@
for (int i = 0; i < (1<<16); i++) {
uint16_t a = rand.nextU() >> 16,
b = rand.nextU() >> 16;
- REPORTER_ASSERT(r, Sk16h::Min(Sk16h(a), Sk16h(b))[0] == SkTMin(a, b));
+ REPORTER_ASSERT(r, Sk16h::Min(Sk16h(a), Sk16h(b))[0] == std::min(a, b));
}
#else
for (int a = 0; a < (1<<16); a++) {
for (int b = 0; b < (1<<16); b++) {
- REPORTER_ASSERT(r, Sk16h::Min(Sk16h(a), Sk16h(b))[0] == SkTMin(a, b));
+ REPORTER_ASSERT(r, Sk16h::Min(Sk16h(a), Sk16h(b))[0] == std::min(a, b));
}}
#endif
}
@@ -230,8 +230,8 @@
auto min = Sk4i::Min(a, b);
auto max = Sk4i::Max(a, b);
for(int i = 0; i < 4; ++i) {
- REPORTER_ASSERT(r, min[i] == SkTMin(a[i], b[i]));
- REPORTER_ASSERT(r, max[i] == SkTMax(a[i], b[i]));
+ REPORTER_ASSERT(r, min[i] == std::min(a[i], b[i]));
+ REPORTER_ASSERT(r, max[i] == std::max(a[i], b[i]));
}
}