Skip to content

Commit

Permalink
Replaced _min and _max with std::min and std::max
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Aug 4, 2017
1 parent afa9869 commit 7eabfa1
Show file tree
Hide file tree
Showing 43 changed files with 126 additions and 126 deletions.
2 changes: 1 addition & 1 deletion src/Layers/xrRender/r__dsgraph_render_lods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void D3DXRenderBase::r_dsgraph_render_lods(bool _setup_zb, bool _clear)

for (u32 i = 0; i < lstLODs.size(); i++)
{
const u32 iBatchSize = _min(lstLODs.size() - i, uiImpostersFit);
const u32 iBatchSize = std::min(lstLODs.size() - i, uiImpostersFit);
int cur_count = 0;
u32 vOffset;
FLOD::_hw* V =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ void dx10ShaderResourceStateCache::SetPSResource(u32 uiSlot, ID3DShaderResourceV
m_PSViews[uiSlot] = pRes;
if (m_bUpdatePSViews)
{
m_uiMinPSView = _min(m_uiMinPSView, uiSlot);
m_uiMaxPSView = _max(m_uiMaxPSView, uiSlot);
m_uiMinPSView = std::min(m_uiMinPSView, uiSlot);
m_uiMaxPSView = std::max(m_uiMaxPSView, uiSlot);
}
else
{
Expand All @@ -123,8 +123,8 @@ void dx10ShaderResourceStateCache::SetGSResource(u32 uiSlot, ID3DShaderResourceV
m_GSViews[uiSlot] = pRes;
if (m_bUpdateGSViews)
{
m_uiMinGSView = _min(m_uiMinGSView, uiSlot);
m_uiMaxGSView = _max(m_uiMaxGSView, uiSlot);
m_uiMinGSView = std::min(m_uiMinGSView, uiSlot);
m_uiMaxGSView = std::max(m_uiMaxGSView, uiSlot);
}
else
{
Expand All @@ -144,8 +144,8 @@ void dx10ShaderResourceStateCache::SetVSResource(u32 uiSlot, ID3DShaderResourceV
m_VSViews[uiSlot] = pRes;
if (m_bUpdateVSViews)
{
m_uiMinVSView = _min(m_uiMinVSView, uiSlot);
m_uiMaxVSView = _max(m_uiMaxVSView, uiSlot);
m_uiMinVSView = std::min(m_uiMinVSView, uiSlot);
m_uiMaxVSView = std::max(m_uiMaxVSView, uiSlot);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRenderPC_R1/LightShadows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ void CLightShadows::calculate()
float p_near = p_dist - p_R - eps;
// float p_nearR = C.C.distance_to(L.source->position) + p_R*0.85f + eps;
// p_nearR = p_near;
float p_far = _min(Lrange, _max(p_dist + S_fade, p_dist + p_R));
float p_far = std::min(Lrange, std::max(p_dist + S_fade, p_dist + p_R));
if (p_near < eps)
continue;
if (p_far < (p_near + eps))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void CLight_Compute_XFORM_and_VIS::compute_xf_spot(light* L)

// _min(L->cone + deg2rad(4.5f), PI*0.98f) - Here, it is needed to enlarge the shadow map frustum to include also
// displaced pixels and the pixels neighbor to the examining one.
L->X.S.project.build_projection(_min(L->cone + deg2rad(5.f), PI * 0.98f), 1.f, SMAP_near_plane, L->range + EPS_S);
L->X.S.project.build_projection(std::min(L->cone + deg2rad(5.f), PI * 0.98f), 1.f, SMAP_near_plane, L->range + EPS_S);

L->X.S.combine.mul(L->X.S.project, L->X.S.view);
}
18 changes: 9 additions & 9 deletions src/Layers/xrRenderPC_R2/r2_R_sun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ struct BoundingBox
void Centroid(D3DXVECTOR3* vec) const { *vec = 0.5f * (minPt + maxPt); }
void Merge(const D3DXVECTOR3* vec)
{
minPt.x = _min(minPt.x, vec->x);
minPt.y = _min(minPt.y, vec->y);
minPt.z = _min(minPt.z, vec->z);
maxPt.x = _max(maxPt.x, vec->x);
maxPt.y = _max(maxPt.y, vec->y);
maxPt.z = _max(maxPt.z, vec->z);
minPt.x = std::min(minPt.x, vec->x);
minPt.y = std::min(minPt.y, vec->y);
minPt.z = std::min(minPt.z, vec->z);
maxPt.x = std::max(maxPt.x, vec->x);
maxPt.y = std::max(maxPt.y, vec->y);
maxPt.z = std::max(maxPt.z, vec->z);
}
D3DXVECTOR3 Point(int i) const
{
Expand Down Expand Up @@ -286,7 +286,7 @@ class FixedConvexVolume
Fvector tmp_point = view_frustum_rays[i].P;

tmp_dist = light_cuboid_polys[align_planes[p]].plane.classify(tmp_point);
min_dist = _min(tmp_dist, min_dist);
min_dist = std::min(tmp_dist, min_dist);
}

Fvector shift = light_cuboid_polys[align_planes[p]].plane.n;
Expand Down Expand Up @@ -747,8 +747,8 @@ D3DXVECTOR2 BuildTSMProjectionMatrix_caster_depth_bounds(D3DXMATRIX& lightSpaceB
{
s_casters[c].getpoint(e, pt);
pt = wform(minmax_xform, pt);
min_z = _min(min_z, pt.z);
max_z = _max(max_z, pt.z);
min_z = std::min(min_z, pt.z);
max_z = std::max(max_z, pt.z);
}
}
return D3DXVECTOR2(min_z, max_z);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,6 @@ void CLight_Compute_XFORM_and_VIS::compute_xf_spot(light* L)

// _min(L->cone + deg2rad(4.5f), PI*0.98f) - Here, it is needed to enlarge the shadow map frustum to include also
// displaced pixels and the pixels neighbor to the examining one.
L->X.S.project.build_projection(_min(L->cone + deg2rad(5.f), PI * 0.98f), 1.f, SMAP_near_plane, L->range + EPS_S);
L->X.S.project.build_projection(std::min(L->cone + deg2rad(5.f), PI * 0.98f), 1.f, SMAP_near_plane, L->range + EPS_S);
L->X.S.combine.mul(L->X.S.project, L->X.S.view);
}
16 changes: 8 additions & 8 deletions src/Layers/xrRenderPC_R3/r2_R_sun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ struct BoundingBox
void Centroid(D3DXVECTOR3* vec) const { *vec = 0.5f * (minPt + maxPt); }
void Merge(const D3DXVECTOR3* vec)
{
minPt.x = _min(minPt.x, vec->x);
minPt.y = _min(minPt.y, vec->y);
minPt.z = _min(minPt.z, vec->z);
maxPt.x = _max(maxPt.x, vec->x);
maxPt.y = _max(maxPt.y, vec->y);
maxPt.z = _max(maxPt.z, vec->z);
minPt.x = std::min(minPt.x, vec->x);
minPt.y = std::min(minPt.y, vec->y);
minPt.z = std::min(minPt.z, vec->z);
maxPt.x = std::max(maxPt.x, vec->x);
maxPt.y = std::max(maxPt.y, vec->y);
maxPt.z = std::max(maxPt.z, vec->z);
}
D3DXVECTOR3 Point(int i) const
{
Expand Down Expand Up @@ -304,8 +304,8 @@ D3DXVECTOR2 BuildTSMProjectionMatrix_caster_depth_bounds(D3DXMATRIX& lightSpaceB
{
s_casters[c].getpoint(e, pt);
pt = wform(minmax_xform, pt);
min_z = _min(min_z, pt.z);
max_z = _max(max_z, pt.z);
min_z = std::min(min_z, pt.z);
max_z = std::max(max_z, pt.z);
}
}
return D3DXVECTOR2(min_z, max_z);
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRenderPC_R3/r3_R_sun_support.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class FixedConvexVolume
Fvector tmp_point = view_frustum_rays[i].P;

tmp_dist = light_cuboid_polys[align_planes[p]].plane.classify(tmp_point);
min_dist = _min(tmp_dist, min_dist);
min_dist = std::min(tmp_dist, min_dist);
}

Fvector shift = light_cuboid_polys[align_planes[p]].plane.n;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,6 @@ void CLight_Compute_XFORM_and_VIS::compute_xf_spot(light* L)

// _min(L->cone + deg2rad(4.5f), PI*0.98f) - Here, it is needed to enlarge the shadow map frustum to include also
// displaced pixels and the pixels neighbor to the examining one.
L->X.S.project.build_projection(_min(L->cone + deg2rad(5.f), PI * 0.98f), 1.f, SMAP_near_plane, L->range + EPS_S);
L->X.S.project.build_projection(std::min(L->cone + deg2rad(5.f), PI * 0.98f), 1.f, SMAP_near_plane, L->range + EPS_S);
L->X.S.combine.mul(L->X.S.project, L->X.S.view);
}
16 changes: 8 additions & 8 deletions src/Layers/xrRenderPC_R4/r2_R_sun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ struct BoundingBox
void Centroid(D3DXVECTOR3* vec) const { *vec = 0.5f * (minPt + maxPt); }
void Merge(const D3DXVECTOR3* vec)
{
minPt.x = _min(minPt.x, vec->x);
minPt.y = _min(minPt.y, vec->y);
minPt.z = _min(minPt.z, vec->z);
maxPt.x = _max(maxPt.x, vec->x);
maxPt.y = _max(maxPt.y, vec->y);
maxPt.z = _max(maxPt.z, vec->z);
minPt.x = std::min(minPt.x, vec->x);
minPt.y = std::min(minPt.y, vec->y);
minPt.z = std::min(minPt.z, vec->z);
maxPt.x = std::max(maxPt.x, vec->x);
maxPt.y = std::max(maxPt.y, vec->y);
maxPt.z = std::max(maxPt.z, vec->z);
}
D3DXVECTOR3 Point(int i) const
{
Expand Down Expand Up @@ -305,8 +305,8 @@ D3DXVECTOR2 BuildTSMProjectionMatrix_caster_depth_bounds(D3DXMATRIX& lightSpaceB
{
s_casters[c].getpoint(e, pt);
pt = wform(minmax_xform, pt);
min_z = _min(min_z, pt.z);
max_z = _max(max_z, pt.z);
min_z = std::min(min_z, pt.z);
max_z = std::max(max_z, pt.z);
}
}
return D3DXVECTOR2(min_z, max_z);
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRenderPC_R4/r4_R_sun_support.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class FixedConvexVolume
Fvector tmp_point = view_frustum_rays[i].P;

tmp_dist = light_cuboid_polys[align_planes[p]].plane.classify(tmp_point);
min_dist = _min(tmp_dist, min_dist);
min_dist = std::min(tmp_dist, min_dist);
}

Fvector shift = light_cuboid_polys[align_planes[p]].plane.n;
Expand Down
6 changes: 3 additions & 3 deletions src/utils/xrDXT/NormalMapGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ Ivector vpack(Fvector src)
float e_best = flt_max;
int r = bx, g = by, b = bz;
int d = 2;
for (int x = _max(bx - d, 0); x <= _min(bx + d, 255); x++)
for (int x = std::max(bx - d, 0); x <= std::min(bx + d, 255); x++)
{
for (int y = _max(by - d, 0); y <= _min(by + d, 255); y++)
for (int y = std::max(by - d, 0); y <= std::min(by + d, 255); y++)
{
for (int z = _max(bz - d, 0); z <= _min(bz + d, 255); z++)
for (int z = std::max(bz - d, 0); z <= std::min(bz + d, 255); z++)
{
_v = vunpack(x, y, z);
float m = _v.magnitude();
Expand Down
8 changes: 4 additions & 4 deletions src/xrAICore/Navigation/level_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,10 @@ u32 CLevelGraph::guess_vertex_id(u32 const& current_vertex_id, Fvector const& po

CVertex const* B = m_nodes;
CVertex const* E = m_nodes + header().vertex_count();
u32 start_x = (u32)_max(0, int(x) - max_guess_vertex_count);
u32 stop_x = _min(max_x(), x + (u32)max_guess_vertex_count);
u32 start_z = (u32)_max(0, int(z) - max_guess_vertex_count);
u32 stop_z = _min(max_z(), z + (u32)max_guess_vertex_count);
u32 start_x = (u32)std::max(0, int(x) - max_guess_vertex_count);
u32 stop_x = std::min(max_x(), x + (u32)max_guess_vertex_count);
u32 start_z = (u32)std::max(0, int(z) - max_guess_vertex_count);
u32 stop_z = std::min(max_z(), z + (u32)max_guess_vertex_count);
for (u32 i = start_x; i <= stop_x; ++i)
{
for (u32 j = start_z; j <= stop_z; ++j)
Expand Down
4 changes: 2 additions & 2 deletions src/xrAICore/Navigation/level_graph_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,8 @@ IC bool CLevelGraph::create_straight_path(u32 start_vertex_id, const Fvector2& s
VERIFY(_valid(tIntersectPoint.z));
#endif

clamp(tIntersectPoint.x, _min(next1.x, next2.x), _max(next1.x, next2.x));
clamp(tIntersectPoint.z, _min(next1.y, next2.y), _max(next1.y, next2.y));
clamp(tIntersectPoint.x, std::min(next1.x, next2.x), std::max(next1.x, next2.x));
clamp(tIntersectPoint.z, std::min(next1.y, next2.y), std::max(next1.y, next2.y));
if (bAssignY)
tIntersectPoint.y = vertex_plane_y(vertex(cur_vertex_id), tIntersectPoint.x, tIntersectPoint.z);
path_node.set_position(tIntersectPoint);
Expand Down
10 changes: 5 additions & 5 deletions src/xrCDB/OPC_Point.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,15 +301,15 @@ class ICEMATHS_API icePoint
inline_ Point& InvTransform(const Point& r, const Matrix3x3& rotpos, const Point& linpos);

//! Returns _min(x, y, z);
inline_ float Min() const { return _min(x, _min(y, z)); }
inline_ float Min() const { return std::min(x, std::min(y, z)); }
//! Returns _max(x, y, z);
inline_ float Max() const { return _max(x, _max(y, z)); }
inline_ float Max() const { return std::max(x, std::max(y, z)); }
//! Sets each element to be componentwise minimum
inline_ Point& Min(const Point& p)
{
x = _min(x, p.x);
y = _min(y, p.y);
z = _min(z, p.z);
x = std::min(x, p.x);
y = std::min(y, p.y);
z = std::min(z, p.z);
return *this;
}
//! Sets each element to be componentwise maximum
Expand Down
8 changes: 4 additions & 4 deletions src/xrCore/_rect.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,10 @@ struct _rect
if (!intersected(b1, b2))
return (FALSE);

x1 = _max(b1.x1, b2.x1);
y1 = _max(b1.y1, b2.y1);
x2 = _min(b1.x2, b2.x2);
y2 = _min(b1.y2, b2.y2);
x1 = std::max(b1.x1, b2.x1);
y1 = std::max(b1.y1, b2.y1);
x2 = std::min(b1.x2, b2.x2);
y2 = std::min(b1.y2, b2.y2);
return (TRUE);
}
};
Expand Down
16 changes: 8 additions & 8 deletions src/xrCore/_vector2.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,26 @@ struct _vector2
}
IC SelfRef min(const Self& p)
{
x = _min(x, p.x);
y = _min(y, p.y);
x = std::min(x, p.x);
y = std::min(y, p.y);
return *this;
}
IC SelfRef min(T _x, T _y)
{
x = _min(x, _x);
y = _min(y, _y);
x = std::min(x, _x);
y = std::min(y, _y);
return *this;
}
IC SelfRef max(const Self& p)
{
x = _max(x, p.x);
y = _max(y, p.y);
x = std::max(x, p.x);
y = std::max(y, p.y);
return *this;
}
IC SelfRef max(T _x, T _y)
{
x = _max(x, _x);
y = _max(y, _y);
x = std::max(x, _x);
y = std::max(y, _y);
return *this;
}
IC SelfRef sub(const T p)
Expand Down
24 changes: 12 additions & 12 deletions src/xrCore/_vector3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,30 +187,30 @@ struct _vector3

IC SelfRef min(const Self& v1, const Self& v2)
{
x = _min(v1.x, v2.x);
y = _min(v1.y, v2.y);
z = _min(v1.z, v2.z);
x = std::min(v1.x, v2.x);
y = std::min(v1.y, v2.y);
z = std::min(v1.z, v2.z);
return *this;
}
IC SelfRef min(const Self& v)
{
x = _min(x, v.x);
y = _min(y, v.y);
z = _min(z, v.z);
x = std::min(x, v.x);
y = std::min(y, v.y);
z = std::min(z, v.z);
return *this;
}
IC SelfRef max(const Self& v1, const Self& v2)
{
x = _max(v1.x, v2.x);
y = _max(v1.y, v2.y);
z = _max(v1.z, v2.z);
x = std::max(v1.x, v2.x);
y = std::max(v1.y, v2.y);
z = std::max(v1.z, v2.z);
return *this;
}
IC SelfRef max(const Self& v)
{
x = _max(x, v.x);
y = _max(y, v.y);
z = _max(z, v.z);
x = std::max(x, v.x);
y = std::max(y, v.y);
z = std::max(z, v.z);
return *this;
}

Expand Down
2 changes: 1 addition & 1 deletion src/xrCore/xrMemory_subst_msvc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ void* xrMemory::mem_realloc(void* P, size_t size)
#endif
// Igor: Reserve 1 byte for xrMemory header
// Don't bother in this case?
memcpy(p_new, p_old, _min(s_current - 1, s_dest));
memcpy(p_new, p_old, std::min(s_current - 1, s_dest));
mem_free(p_old);
_ptr = p_new;
}
Expand Down
2 changes: 1 addition & 1 deletion src/xrEngine/Environment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ CEnvironment::CEnvironment() : CurrentEnv(0), m_ambients_config(0)
// params
p_var_alt = deg2rad(config->r_float("environment", "altitude"));
p_var_long = deg2rad(config->r_float("environment", "delta_longitude"));
p_min_dist = _min(.95f, config->r_float("environment", "min_dist_factor"));
p_min_dist = std::min(.95f, config->r_float("environment", "min_dist_factor"));
p_tilt = deg2rad(config->r_float("environment", "tilt"));
p_second_prop = config->r_float("environment", "second_propability");
clamp(p_second_prop, 0.f, 1.f);
Expand Down
2 changes: 1 addition & 1 deletion src/xrEngine/IGame_Level.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ void IGame_Level::SoundEvent_Register(ref_sound_data_ptr S, float range)
}

VERIFY(p && _valid(range));
range = _min(range, p->max_ai_distance);
range = std::min(range, p->max_ai_distance);
VERIFY(_valid(snd_position));
VERIFY(_valid(p->max_ai_distance));
VERIFY(_valid(p->volume));
Expand Down
2 changes: 1 addition & 1 deletion src/xrEngine/XR_IOConsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ void CConsole::DrawBackgrounds(bool bGame)
float list_w = pFont->SizeOf_(max_str) + 2.0f * w1;

float font_h = pFont->CurrentHeight_();
float tips_h = _min(m_tips.size(), (u32)VIEW_TIPS_COUNT) * font_h;
float tips_h = std::min(m_tips.size(), (u32)VIEW_TIPS_COUNT) * font_h;
tips_h += (m_tips.size() > 0) ? 5.0f : 0.0f;

Frect pr, sr;
Expand Down
Loading

0 comments on commit 7eabfa1

Please sign in to comment.