diff --git a/common/decompile.cc b/common/decompile.cc index 268231b6..616e8e74 100644 --- a/common/decompile.cc +++ b/common/decompile.cc @@ -1200,7 +1200,7 @@ static void DecompileEntity( // decompile the leafs in parallel compiledBrushes.resize(tasks.size()); - tbb::parallel_for(static_cast(0), tasks.size(), [&](const size_t &i) { + tbb::parallel_for(static_cast(0), tasks.size(), [&](size_t i) { compiledBrushes[i] = DecompileLeafTaskGeometryOnly(bsp, tasks[i], brush_offset); }); } else if (bsp->loadversion->game->id == GAME_QUAKE_II && !options.ignoreBrushes) { @@ -1251,7 +1251,7 @@ static void DecompileEntity( compiledBrushes.resize(brushes.size()); size_t t = brushes.size(); - tbb::parallel_for(static_cast(0), brushes.size(), [&](const size_t &i) { + tbb::parallel_for(static_cast(0), brushes.size(), [&](size_t i) { compiledBrushes[i] = DecompileBrushTask(bsp, options, brushesVector[i], brush_offset); t--; }); @@ -1267,7 +1267,7 @@ static void DecompileEntity( // decompile the leafs in parallel compiledBrushes.resize(tasks.size()); - tbb::parallel_for(static_cast(0), tasks.size(), [&](const size_t &i) { + tbb::parallel_for(static_cast(0), tasks.size(), [&](size_t i) { if (options.geometryOnly) { compiledBrushes[i] = DecompileLeafTaskGeometryOnly(bsp, tasks[i], brush_offset); } else { @@ -1427,7 +1427,7 @@ std::vector VisualizeLeafs(const mbsp_t &bsp, int modelnum // decompile the leafs in parallel compiledBrushes.resize(tasks.size()); - tbb::parallel_for(static_cast(0), tasks.size(), [&](const size_t &i) { + tbb::parallel_for(static_cast(0), tasks.size(), [&](size_t i) { compiledBrushes[i] = DecompileLeafTaskLeafVisualization(&bsp, tasks[i], std::nullopt); }); diff --git a/include/common/aabb.hh b/include/common/aabb.hh index c001707b..5453a705 100644 --- a/include/common/aabb.hh +++ b/include/common/aabb.hh @@ -226,9 +226,9 @@ public: constexpr aabb grow(const value_type &size) const { return {mins() - size, maxs() + size}; } - constexpr value_type &operator[](const size_t &index) { return m_corners[index]; } + constexpr value_type &operator[](size_t index) { return m_corners[index]; } - constexpr const value_type &operator[](const size_t &index) const { return m_corners[index]; } + constexpr const value_type &operator[](size_t index) const { return m_corners[index]; } constexpr value_type centroid() const { return (mins() + maxs()) * 0.5; } diff --git a/include/common/polylib.hh b/include/common/polylib.hh index cec41968..ac7445ac 100644 --- a/include/common/polylib.hh +++ b/include/common/polylib.hh @@ -62,7 +62,7 @@ public: // construct winding with initial size; may allocate // memory, and sets size, but does not initialize any // of them. - inline winding_storage_stack_t(const size_t &initial_size) + inline winding_storage_stack_t(size_t initial_size) : count(initial_size) { if (initial_size > N) { @@ -124,7 +124,7 @@ public: inline size_t size() const { return count; } - inline vec3_type &at(const size_t &index) + inline vec3_type &at(size_t index) { #ifdef _DEBUG if (index >= count) @@ -134,7 +134,7 @@ public: return array[index]; } - inline const vec3_type &at(const size_t &index) const + inline const vec3_type &at(size_t index) const { #ifdef _DEBUG if (index >= count) @@ -145,10 +145,10 @@ public: } // un-bounds-checked - inline vec3_type &operator[](const size_t &index) { return array[index]; } + inline vec3_type &operator[](size_t index) { return array[index]; } // un-bounds-checked - inline const vec3_type &operator[](const size_t &index) const { return array[index]; } + inline const vec3_type &operator[](size_t index) const { return array[index]; } using const_iterator = typename array_type::const_iterator; @@ -173,7 +173,7 @@ public: return (array[count - 1] = vec); } - inline void resize(const size_t &new_size) + inline void resize(size_t new_size) { if (new_size > N) { throw std::bad_alloc(); @@ -204,7 +204,7 @@ public: // construct winding with initial size; may allocate // memory, and sets size, but does not initialize any // of them. - inline winding_storage_heap_t(const size_t &initial_size) + inline winding_storage_heap_t(size_t initial_size) : values(initial_size) { } @@ -252,15 +252,15 @@ public: inline size_t size() const { return values.size(); } - inline vec3_type &at(const size_t &index) { return values[index]; } + inline vec3_type &at(size_t index) { return values[index]; } - inline const vec3_type &at(const size_t &index) const { return values[index]; } + inline const vec3_type &at(size_t index) const { return values[index]; } // un-bounds-checked - inline vec3_type &operator[](const size_t &index) { return values[index]; } + inline vec3_type &operator[](size_t index) { return values[index]; } // un-bounds-checked - inline const vec3_type &operator[](const size_t &index) const { return values[index]; } + inline const vec3_type &operator[](size_t index) const { return values[index]; } inline const auto begin() const { return values.begin(); } @@ -272,7 +272,7 @@ public: inline vec3_type &emplace_back(const vec3_type &vec) { return values.emplace_back(vec); } - inline void resize(const size_t &new_size) { values.resize(new_size); } + inline void resize(size_t new_size) { values.resize(new_size); } inline void reserve(size_t size) { values.reserve(size); } @@ -396,7 +396,7 @@ public: // construct winding with initial size; may allocate // memory, and sets size, but does not initialize any // of them. - inline winding_storage_hybrid_t(const size_t &initial_size) + inline winding_storage_hybrid_t(size_t initial_size) : count(initial_size) { if (count > N) { @@ -491,7 +491,7 @@ public: inline size_t vector_size() const { return vector.size(); } - inline vec3_type &at(const size_t &index) + inline vec3_type &at(size_t index) { #ifdef _DEBUG if (index >= count) @@ -505,7 +505,7 @@ public: return array[index]; } - inline const vec3_type &at(const size_t &index) const + inline const vec3_type &at(size_t index) const { #ifdef _DEBUG if (index >= count) @@ -520,7 +520,7 @@ public: } // un-bounds-checked - inline vec3_type &operator[](const size_t &index) + inline vec3_type &operator[](size_t index) { if (index >= N) { return vector[index - N]; @@ -530,7 +530,7 @@ public: } // un-bounds-checked - inline const vec3_type &operator[](const size_t &index) const + inline const vec3_type &operator[](size_t index) const { if (index >= N) { return vector[index - N]; @@ -562,7 +562,7 @@ public: return (array[count - 1] = vec); } - inline void resize(const size_t &new_size) + inline void resize(size_t new_size) { // resize vector if necessary if (new_size > N) { @@ -595,7 +595,7 @@ public: // construct winding with initial size; may allocate // memory, and sets size, but does not initialize any // of them. - inline winding_base_t(const size_t &initial_size) + inline winding_base_t(size_t initial_size) : storage(initial_size) { } @@ -639,15 +639,15 @@ public: inline size_t size() const { return storage.size(); } - inline vec3_type &at(const size_t &index) { return storage.at(index); } + inline vec3_type &at(size_t index) { return storage.at(index); } - inline const vec3_type &at(const size_t &index) const { return storage.at(index); } + inline const vec3_type &at(size_t index) const { return storage.at(index); } // un-bounds-checked - inline vec3_type &operator[](const size_t &index) { return storage[index]; } + inline vec3_type &operator[](size_t index) { return storage[index]; } // un-bounds-checked - inline const vec3_type &operator[](const size_t &index) const { return storage[index]; } + inline const vec3_type &operator[](size_t index) const { return storage[index]; } inline const auto begin() const { return storage.begin(); } @@ -665,7 +665,7 @@ public: inline void push_back(const vec3_type &vec) { storage.emplace_back(vec); } - inline void resize(const size_t &new_size) { storage.resize(new_size); } + inline void resize(size_t new_size) { storage.resize(new_size); } inline void reserve(size_t size) { storage.reserve(size); } diff --git a/include/qbsp/map.hh b/include/qbsp/map.hh index 25414a6e..621817a6 100644 --- a/include/qbsp/map.hh +++ b/include/qbsp/map.hh @@ -227,7 +227,7 @@ struct mapdata_t std::optional find_emitted_hash_vector(const qvec3d &vert); // add vector to hash - void add_hash_vector(const qvec3d &point, const size_t &num); + void add_hash_vector(const qvec3d &point, size_t num); // hashed edges; generated by EmitEdges std::map, hashedge_t> hashedges; diff --git a/include/vis/leafbits.hh b/include/vis/leafbits.hh index 9befd706..91363bcb 100644 --- a/include/vis/leafbits.hh +++ b/include/vis/leafbits.hh @@ -75,7 +75,7 @@ public: return *this; } - constexpr const size_t &size() const { return _size; } + constexpr size_t size() const { return _size; } // this clears existing bit data! inline void resize(size_t new_size) { *this = leafbits_t(new_size); } @@ -86,7 +86,7 @@ public: inline uint32_t *data() { return bits.get(); } inline const uint32_t *data() const { return bits.get(); } - inline bool operator[](const size_t &index) const { return !!(bits[index >> shift] & nth_bit(index & mask)); } + inline bool operator[](size_t index) const { return !!(bits[index >> shift] & nth_bit(index & mask)); } struct reference { @@ -107,5 +107,5 @@ public: } }; - inline reference operator[](const size_t &index) { return {bits, index >> shift, nth_bit(index & mask)}; } + inline reference operator[](size_t index) { return {bits, index >> shift, nth_bit(index & mask)}; } }; diff --git a/qbsp/faces.cc b/qbsp/faces.cc index 3bfea7f0..0e79981e 100644 --- a/qbsp/faces.cc +++ b/qbsp/faces.cc @@ -142,7 +142,7 @@ GetEdge Returns a global edge number, possibly negative to indicate a backwards edge. ================== */ -inline int64_t GetEdge(const size_t &v1, const size_t &v2, const face_t *face, emit_faces_stats_t &stats) +inline int64_t GetEdge(size_t v1, size_t v2, const face_t *face, emit_faces_stats_t &stats) { if (!face->contents.front.is_valid(qbsp_options.target_game, false)) FError("Face with invalid contents"); diff --git a/qbsp/map.cc b/qbsp/map.cc index 3f7c87fb..a2bfbf84 100644 --- a/qbsp/map.cc +++ b/qbsp/map.cc @@ -161,7 +161,7 @@ std::optional mapdata_t::find_emitted_hash_vector(const qvec3d &vert) } // add vector to hash -void mapdata_t::add_hash_vector(const qvec3d &point, const size_t &num) +void mapdata_t::add_hash_vector(const qvec3d &point, size_t num) { hashverts->hash.emplace(pareto::point({point[0], point[1], point[2]}), num); } diff --git a/qbsp/tjunc.cc b/qbsp/tjunc.cc index 6a2c01bf..02e5ffb4 100644 --- a/qbsp/tjunc.cc +++ b/qbsp/tjunc.cc @@ -454,7 +454,7 @@ static std::list> compress_triangles_into_fans( { size_t seed, vert_count; - bool operator()(const size_t &a, const size_t &b) const + bool operator()(size_t a, size_t b) const { size_t ka = a < seed ? vert_count + a : a; size_t kb = b < seed ? vert_count + b : b;