diff --git a/common/aicore/cm.cpp b/common/aicore/cm.cpp index 2dddf90318..732e675aff 100644 --- a/common/aicore/cm.cpp +++ b/common/aicore/cm.cpp @@ -2133,7 +2133,7 @@ bool operator==(const struct cm_parameter &p1, const struct cm_parameter &p2) void cm_copy_parameter(struct cm_parameter *dest, const struct cm_parameter *const src) { - memcpy(dest, src, sizeof(struct cm_parameter)); + *dest = *src; } /** diff --git a/common/aicore/cm.h b/common/aicore/cm.h index b470eeef79..38fa3ea700 100644 --- a/common/aicore/cm.h +++ b/common/aicore/cm.h @@ -22,6 +22,13 @@ struct cm_parameter { int factor[O_LAST]; int happy_factor; + + /** + * @brief Copy assignment operator + * @param other Object being copied + * @return Reference to *this + */ + cm_parameter &operator=(const cm_parameter &other) = default; }; // A result which can examined. diff --git a/common/aicore/path_finding.cpp b/common/aicore/path_finding.cpp index c586130d44..a8e9b48af0 100644 --- a/common/aicore/path_finding.cpp +++ b/common/aicore/path_finding.cpp @@ -95,8 +95,22 @@ struct pf_map { struct pf_parameter params; // Initial parameters. }; -// Down-cast macro. -#define PF_MAP(pfm) ((struct pf_map *) (pfm)) +/** + * Casts to `pf_map` + * + * \fixme Capitalized because this used to be a macro. + */ +pf_map *PF_MAP(void *x) { return reinterpret_cast(x); } + +/** + * Casts to `pf_map` + * + * \fixme Capitalized because this used to be a macro. + */ +const pf_map *PF_MAP(const void *x) +{ + return reinterpret_cast(x); +} // ========================== Common functions ===========================