From cde34d80413606d31ea1abe3a25e88eab544c92d Mon Sep 17 00:00:00 2001 From: elsid Date: Fri, 21 Nov 2025 13:53:58 +0100 Subject: [PATCH] Fix C4244 in navmeshtilescache benchmark apps\benchmarks\detournavigator\navmeshtilescache.cpp(97): warning C4244: 'argument': conversion from 'double' to 'size_t', possible loss of data apps\benchmarks\detournavigator\navmeshtilescache.cpp(97): note: the template instantiation context (the oldest one first) is apps\benchmarks\detournavigator\navmeshtilescache.cpp(192): note: see reference to function template instantiation 'void `anonymous-namespace'::getFromFilledCache<1048576,100>(benchmark::State &)' being compiled apps\benchmarks\detournavigator\navmeshtilescache.cpp(179): note: see reference to function template instantiation 'void `anonymous-namespace'::generateKeys>>,std::linear_congruential_engine>(_T0,size_t,_T1 &)' being compiled with [ _T0=std::back_insert_iterator>>, _T1=std::linear_congruential_engine ] apps\benchmarks\detournavigator\navmeshtilescache.cpp(153): note: see reference to function template instantiation '`anonymous-namespace'::Key `anonymous-namespace'::generateKey<_T1>(size_t,_T0 &)' being compiled with [ _T1=std::linear_congruential_engine, _T0=std::linear_congruential_engine ] apps\benchmarks\detournavigator\navmeshtilescache.cpp(141): note: see reference to function template instantiation 'DetourNavigator::Mesh `anonymous-namespace'::generateMesh<_T0>(size_t,_T0 &)' being compiled with [ _T0=std::linear_congruential_engine ] apps\benchmarks\detournavigator\navmeshtilescache.cpp(99): warning C4244: 'argument': conversion from 'double' to 'size_t', possible loss of data apps\benchmarks\detournavigator\navmeshtilescache.cpp(112): warning C4244: '=': conversion from 'double' to 'float', possible loss of data apps\benchmarks\detournavigator\navmeshtilescache.cpp(112): note: the template instantiation context (the oldest one first) is apps\benchmarks\detournavigator\navmeshtilescache.cpp(144): note: see reference to function template instantiation 'DetourNavigator::Heightfield `anonymous-namespace'::generateHeightfield<_T0>(_T0 &)' being compiled with [ _T0=std::linear_congruential_engine ] --- apps/benchmarks/detournavigator/navmeshtilescache.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/benchmarks/detournavigator/navmeshtilescache.cpp b/apps/benchmarks/detournavigator/navmeshtilescache.cpp index 7c5795a81e..b2d02e2cea 100644 --- a/apps/benchmarks/detournavigator/navmeshtilescache.cpp +++ b/apps/benchmarks/detournavigator/navmeshtilescache.cpp @@ -94,9 +94,9 @@ namespace std::vector areaTypes; if (distribution(random) < 0.939) { - generateVertices(std::back_inserter(vertices), triangles * 2.467, random); + generateVertices(std::back_inserter(vertices), static_cast(triangles * 2.467), random); generateIndices(std::back_inserter(indices), static_cast(vertices.size() / 3) - 1, - vertices.size() * 1.279, random); + static_cast(vertices.size() * 1.279), random); generateAreaTypes(std::back_inserter(areaTypes), indices.size() / 3, random); } return Mesh(std::move(indices), std::move(vertices), std::move(areaTypes)); @@ -109,7 +109,7 @@ namespace result.mCellPosition = generateVec2i(1000, random); result.mCellSize = ESM::Land::REAL_SIZE; result.mMinHeight = distribution(random); - result.mMaxHeight = result.mMinHeight + 1.0; + result.mMaxHeight = result.mMinHeight + 1.0f; result.mLength = static_cast(ESM::Land::LAND_SIZE); std::generate_n( std::back_inserter(result.mHeights), ESM::Land::LAND_NUM_VERTS, [&] { return distribution(random); });