BLI: Use inline instead of static for bounds functions

Avoid instantiating the templates separately in every translation unit.
This saves 20 KB in my Blender binary. Also remove a timer mistakenly
committed.
This commit is contained in:
Hans Goudey 2023-05-09 12:54:55 -04:00
parent aefda7cb0b
commit 3f44b24cf2
2 changed files with 2 additions and 3 deletions

View File

@ -19,7 +19,7 @@ namespace blender::bounds {
/**
* Find the smallest and largest values element-wise in the span.
*/
template<typename T> static std::optional<Bounds<T>> min_max(Span<T> values)
template<typename T> inline std::optional<Bounds<T>> min_max(Span<T> values)
{
if (values.is_empty()) {
return std::nullopt;
@ -46,7 +46,7 @@ template<typename T> static std::optional<Bounds<T>> min_max(Span<T> values)
* first. The template type T is expected to have an addition operator implemented with RadiusT.
*/
template<typename T, typename RadiusT>
static std::optional<Bounds<T>> min_max_with_radii(Span<T> values, Span<RadiusT> radii)
inline std::optional<Bounds<T>> min_max_with_radii(Span<T> values, Span<RadiusT> radii)
{
BLI_assert(values.size() == radii.size());
if (values.is_empty()) {

View File

@ -1613,7 +1613,6 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMesh
void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me, const CustomData_MeshMasks *cd_mask_extra)
{
SCOPED_TIMER_AVERAGED(__func__);
/* NOTE: The function is called from multiple threads with the same input BMesh and different
* mesh objects. */