Skip to content

Commit 0927c76

Browse files
committed
i can't even
1 parent bf5124f commit 0927c76

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

Diff for: source/Colors/TColor.inl

+10-6
Original file line numberDiff line numberDiff line change
@@ -110,26 +110,30 @@ namespace Langulus::Math
110110

111111
if (not initialized) {
112112
// Attempt converting from any other kinds of numbers
113+
constexpr auto DEF = Default; // workarounds for stupid
114+
constexpr auto S = MemberCount; // gcc capture bugs >_<
115+
constexpr auto IsR = IsReal; //
116+
113117
Typelists::Arithmetic::ForEachOr([&]<class AS>{
114118
if constexpr (not CT::Similar<InnerT, AS>) {
115-
AS all_as[TColor<T>::MemberCount];
119+
AS all_as[S];
116120
initialized = describe->ExtractData(all_as);
117121
if (initialized) {
118-
if constexpr (TColor<T>::IsReal and CT::Integer<AS>) {
122+
if constexpr (IsR and CT::Integer<AS>) {
119123
// If we're initializing real color using integers,
120124
// we have to divide by 255 and saturate (TODO)
121-
SIMD::Convert<TColor<T>::Default>(all_as, this->all);
125+
SIMD::Convert<DEF>(all_as, this->all);
122126
*this /= InnerT {255};
123127
}
124-
else if constexpr (not TColor<T>::IsReal and CT::Real<AS>) {
128+
else if constexpr (not IsR and CT::Real<AS>) {
125129
// If we're initializing integer color using reals,
126130
// we have to multiply by 255 and saturate
127131
SIMD::Multiply(all_as, AS {255}, all_as);
128132
SIMD::Min(all_as, InnerT {255}, all_as);
129133
SIMD::Max(all_as, InnerT {0}, all_as);
130-
SIMD::Convert<TColor<T>::Default>(all_as, this->all);
134+
SIMD::Convert<DEF>(all_as, this->all);
131135
}
132-
else SIMD::Convert<TColor<T>::Default>(all_as, this->all);
136+
else SIMD::Convert<DEF>(all_as, this->all);
133137
}
134138
return initialized > 0;
135139
}

0 commit comments

Comments
 (0)