Commit: 3060b98842fe1b1bca6cce6678ee8a022583e63f Author: Hans Goudey Date: Tue May 31 16:55:14 2022 +0200 Branches: master https://developer.blender.org/rB3060b98842fe1b1bca6cce6678ee8a022583e63f
Cleanup: Simplify dependencies for GMP math header Previously, the base math headers included GMP headers in all cases. This was problematic because we don't want all modules that use the math headers to depend on GMP, and the unnecessary includes could theoretically have detrimental effects to compile times. Now `BLI_math_mpq.hh` depends on `BLI_math_base.hh`, so if a file needs to use exact arithmatic, it can just include the former. Differential Revision: https://developer.blender.org/D15079 =================================================================== M source/blender/blenlib/BLI_math_base.hh M source/blender/blenlib/BLI_math_mpq.hh M source/blender/blenlib/BLI_math_vec_types.hh =================================================================== diff --git a/source/blender/blenlib/BLI_math_base.hh b/source/blender/blenlib/BLI_math_base.hh index 034c6968c94..3057e30dc03 100644 --- a/source/blender/blenlib/BLI_math_base.hh +++ b/source/blender/blenlib/BLI_math_base.hh @@ -14,19 +14,9 @@ #include "BLI_math_base_safe.h" #include "BLI_utildefines.h" -#ifdef WITH_GMP -# include "BLI_math_mpq.hh" -#endif - namespace blender::math { -template<typename T> -inline constexpr bool is_math_float_type = (std::is_floating_point_v<T> -#ifdef WITH_GMP - || std::is_same_v<T, mpq_class> -#endif -); - +template<typename T> inline constexpr bool is_math_float_type = std::is_floating_point_v<T>; template<typename T> inline constexpr bool is_math_integral_type = std::is_integral_v<T>; template<typename T> inline bool is_zero(const T &a) diff --git a/source/blender/blenlib/BLI_math_mpq.hh b/source/blender/blenlib/BLI_math_mpq.hh index 7b43c90da84..02c92705323 100644 --- a/source/blender/blenlib/BLI_math_mpq.hh +++ b/source/blender/blenlib/BLI_math_mpq.hh @@ -19,4 +19,10 @@ */ # include "gmpxx.h" +# include "BLI_math_base.hh" + +namespace blender::math { +template<> inline constexpr bool is_math_float_type<mpq_class> = true; +} + #endif /* WITH_GMP */ diff --git a/source/blender/blenlib/BLI_math_vec_types.hh b/source/blender/blenlib/BLI_math_vec_types.hh index e36bbedee32..7f20881dfa3 100644 --- a/source/blender/blenlib/BLI_math_vec_types.hh +++ b/source/blender/blenlib/BLI_math_vec_types.hh @@ -14,10 +14,6 @@ #include "BLI_utildefines.h" -#ifdef WITH_GMP -# include "BLI_math_mpq.hh" -#endif - namespace blender { /* clang-format off */ _______________________________________________ Bf-blender-cvs mailing list [email protected] List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
