cleanup: don't pass double by reference (it's only 8 bytes)

This commit is contained in:
Eric Wasylishen 2024-11-17 21:34:54 -07:00
parent c755f47c03
commit 71933f2be1
5 changed files with 5 additions and 10 deletions

View File

@ -600,7 +600,7 @@ std::array<std::pair<qvec2i, float>, 4> bilinearWeightsAndCoords(qvec2f pos, con
* - the direction doesn't matter.
* - only tips touching is enough
*/
bool LinesOverlap(const qvec3f &p0, const qvec3f &p1, const qvec3f &q0, const qvec3f &q1, const double &on_epsilon)
bool LinesOverlap(const qvec3f &p0, const qvec3f &p1, const qvec3f &q0, const qvec3f &q1, double on_epsilon)
{
const float q0_linedist = DistToLine(p0, p1, q0);
if (q0_linedist > on_epsilon)

View File

@ -285,7 +285,7 @@ inline std::ostream &operator<=(std::ostream &s, const float &c)
return s;
}
inline std::ostream &operator<=(std::ostream &s, const double &c)
inline std::ostream &operator<=(std::ostream &s, double c)
{
if (!detail::need_swap(s))
s.write(reinterpret_cast<const char *>(&c), sizeof(c));

View File

@ -1178,7 +1178,7 @@ std::vector<V> PointsAlongLine(const V &start, const V &end, const float step)
}
bool LinesOverlap(const qvec3f &p0, const qvec3f &p1, const qvec3f &q0, const qvec3f &q1,
const double &on_epsilon = DEFAULT_ON_EPSILON);
double on_epsilon = DEFAULT_ON_EPSILON);
template<typename T>
struct twosided

View File

@ -337,8 +337,7 @@ public:
[[nodiscard]] qbsp_plane_t operator-() const;
[[nodiscard]] const plane_type_t &get_type() const;
[[nodiscard]] const double &get_dist() const;
[[nodiscard]] double &get_dist();
[[nodiscard]] double get_dist() const;
[[nodiscard]] const qvec3d &get_normal() const;
bool set_normal(const qvec3d &vec, bool flip = false);
bool set_plane(const qplane3d &plane, bool flip = false);

View File

@ -321,11 +321,7 @@ qbsp_plane_t &qbsp_plane_t::operator=(const qplane3d &plane) noexcept
{
return type;
}
[[nodiscard]] const double &qbsp_plane_t::get_dist() const
{
return plane.dist;
}
[[nodiscard]] double &qbsp_plane_t::get_dist()
[[nodiscard]] double qbsp_plane_t::get_dist() const
{
return plane.dist;
}