summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/3dom2_te.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/video/3dom2_te.cpp')
-rw-r--r--src/mame/video/3dom2_te.cpp47
1 files changed, 16 insertions, 31 deletions
diff --git a/src/mame/video/3dom2_te.cpp b/src/mame/video/3dom2_te.cpp
index 7aa79a67924..ecacdfbe6e7 100644
--- a/src/mame/video/3dom2_te.cpp
+++ b/src/mame/video/3dom2_te.cpp
@@ -1502,21 +1502,6 @@ uint32_t nr_invert(uint32_t num, uint32_t & shift_amount)
//-------------------------------------------------
-// clamp -
-//-------------------------------------------------
-
-uint32_t clamp(int32_t v, int32_t min, int32_t max)
-{
- if (v < min)
- return min;
- else if (v > max)
- return max;
-
- return v;
-}
-
-
-//-------------------------------------------------
// walk_edges -
//-------------------------------------------------
@@ -1664,10 +1649,10 @@ void m2_te_device::walk_edges(uint32_t wrange)
}
// Clamp to 8.11
- r = clamp(r, 0, 0x0007ffff);
- g = clamp(g, 0, 0x0007ffff);
- b = clamp(b, 0, 0x0007ffff);
- a = clamp(a, 0, 0x0007ffff);
+ r = std::clamp<int32_t>(r, 0, 0x0007ffff);
+ g = std::clamp<int32_t>(g, 0, 0x0007ffff);
+ b = std::clamp<int32_t>(b, 0, 0x0007ffff);
+ a = std::clamp<int32_t>(a, 0, 0x0007ffff);
}
if (!(m_es.es_cntl & TEMASTER_MODE_DTEXT))
@@ -1684,8 +1669,8 @@ void m2_te_device::walk_edges(uint32_t wrange)
}
// Clamp to 10.13
- uw = clamp(uw, 0, 0x007fffff);
- vw = clamp(vw, 0, 0x007fffff);
+ uw = std::clamp<int32_t>(uw, 0, 0x007fffff);
+ vw = std::clamp<int32_t>(vw, 0, 0x007fffff);
}
if (!(m_es.es_cntl & ESCNTL_PERSPECTIVEOFF))
@@ -1696,7 +1681,7 @@ void m2_te_device::walk_edges(uint32_t wrange)
w += step_back ? m_es.slope_w - m_es.ddx_w : m_es.slope_w;
// Clamp to 0.23
- w = clamp(w, 0, 0x007fffff);
+ w = std::clamp<int32_t>(w, 0, 0x007fffff);
}
// Update Y
@@ -1924,8 +1909,8 @@ void m2_te_device::addr_calc(uint32_t u, uint32_t v, uint32_t lod,
u_max &= u_mask;
v_max &= v_mask;
- u0 = clamp(u0, 0, u_max);
- v0 = clamp(v0, 0, v_max);
+ u0 = std::min(u0, u_max);
+ v0 = std::min(v0, v_max);
// LOD
uint32_t lodmax = m_tm.tex_addr_cntl & TXTADDRCNTL_LODMAX_MASK;
@@ -3256,17 +3241,17 @@ void m2_te_device::walk_span(uint32_t wrange, bool omit_right,
}
// Clamp to 11.8
- r = clamp(r, 0, 0x0007ffff);
- g = clamp(g, 0, 0x0007ffff);
- b = clamp(b, 0, 0x0007ffff);
- a = clamp(a, 0, 0x0007ffff);
+ r = std::clamp<int32_t>(r, 0, 0x0007ffff);
+ g = std::clamp<int32_t>(g, 0, 0x0007ffff);
+ b = std::clamp<int32_t>(b, 0, 0x0007ffff);
+ a = std::clamp<int32_t>(a, 0, 0x0007ffff);
// Clamp to 10.13
- uw = clamp(uw, 0, 0x007fffff);
- vw = clamp(vw, 0, 0x007fffff);
+ uw = std::clamp<int32_t>(uw, 0, 0x007fffff);
+ vw = std::clamp<int32_t>(vw, 0, 0x007fffff);
// Clamp to 0.23
- w = clamp(w, 0, 0x007fffff);
+ w = std::clamp<int32_t>(w, 0, 0x007fffff);
#if TEST_TIMING
g_statistics[STAT_PIXELS_PROCESSED]++;