godot icon indicating copy to clipboard operation
godot copied to clipboard

Core: Add `constexpr` constructors to math structs

Open Repiteo opened this issue 1 year ago • 1 comments

Subsection of #91992

I quickly realized the scope of adding constexpr to math structs, even at a reduced scope, made for a pretty daunting and exhaustive changelog overall. So instead, this aims to be a significantly reduced version of the original commit by focusing exclusively on constructors. In the interest of keeping the changecount as low as possible, no attempts were made to reorganize the structs from how they are now. Absolutely no other functions were made constexpr; if a constructor relied on other functions in their constructors, they simply weren't converted.

The only changes outside of constructors were:

  • Removing redundant variables (would cause warnings/errors in GCC).
  • Removing Projection's empty destructor.
  • Changing Vector2/Vector2i's union struct layout from 2 layers of nesting to 1 (intellisense throws a fit otherwise).
  • Added NOLINT sections for clang-tidy to union struts (parsing logic gets confused otherwise).

Repiteo avatar May 17 '24 19:05 Repiteo

While rebasing, I made one more adjustment: adding NOLINT sections for clang-tidy, as the union sections otherwise confuse the parsing logic.

Repiteo avatar Jun 18 '24 16:06 Repiteo

Superseded by #100918

Repiteo avatar Jan 02 '25 17:01 Repiteo