mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-12 09:20:36 +00:00
LibGfx: Add VectorN::to_type<T>()
This commit is contained in:
parent
dfe002cfd4
commit
878111abf6
Notes:
sideshowbarker
2024-07-18 02:13:10 +09:00
Author: https://github.com/gmta Commit: https://github.com/SerenityOS/serenity/commit/878111abf6 Pull-request: https://github.com/SerenityOS/serenity/pull/13970 Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/linusg Reviewed-by: https://github.com/sunverwerth ✅
1 changed files with 10 additions and 0 deletions
|
@ -224,6 +224,16 @@ public:
|
|||
return String::formatted("[{},{},{},{}]", x(), y(), z(), w());
|
||||
}
|
||||
|
||||
template<typename U>
|
||||
[[nodiscard]] VectorN<N, U> to_type() const
|
||||
{
|
||||
VectorN<N, U> result;
|
||||
UNROLL_LOOP
|
||||
for (auto i = 0u; i < N; ++i)
|
||||
result.data()[i] = static_cast<U>(m_data[i]);
|
||||
return result;
|
||||
}
|
||||
|
||||
template<typename U>
|
||||
[[nodiscard]] VectorN<N, U> to_rounded() const
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue