Skip to content

Commit 22e9025

Browse files
committed
Trying to work around ICE
1 parent 48e0e3e commit 22e9025

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

source/Colors/TColor.hpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,15 @@ namespace Langulus
109109

110110
using T::all;
111111

112-
using T::Default;
113-
using T::MemberCount;
114-
using T::IsReal;
115-
static_assert(MemberCount > 1 and MemberCount < 5,
116-
"Invalid number of channels");
112+
static constexpr InnerT Default = T::Default;
113+
static constexpr Count MemberCount = T::MemberCount;
114+
static constexpr bool IsReal = T::IsReal;
117115
static constexpr bool CTTI_ColorTrait = true;
118116
static constexpr bool CTTI_SaturatedTrait = true;
119117

118+
static_assert(MemberCount > 1 and MemberCount < 5,
119+
"Invalid number of channels");
120+
120121
private:
121122
/// Custom name generator at compile-time for colors
122123
static constexpr auto GenerateToken() {

source/Colors/TColor.inl

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

111111
if (not initialized) {
112112
// Attempt converting from any other kinds of numbers
113-
Typelists::Arithmetic::ForEachOr([this, &initialized, &describe]<class AS>(){
113+
Typelists::Arithmetic::ForEachOr([&]<class AS>{
114114
if constexpr (not CT::Similar<InnerT, AS>) {
115-
AS all_as[this->MemberCount];
115+
AS all_as[MemberCount];
116116
initialized = describe->ExtractData(all_as);
117117
if (initialized) {
118-
if constexpr (this->IsReal and CT::Integer<AS>) {
118+
if constexpr (IsReal and CT::Integer<AS>) {
119119
// If we're initializing real color using integers,
120120
// we have to divide by 255 and saturate (TODO)
121-
SIMD::Convert<this->Default>(all_as, this->all);
121+
SIMD::Convert<Default>(all_as, this->all);
122122
*this /= InnerT {255};
123123
}
124-
else if constexpr (not this->IsReal and CT::Real<AS>) {
124+
else if constexpr (not IsReal and CT::Real<AS>) {
125125
// If we're initializing integer color using reals,
126126
// we have to multiply by 255 and saturate
127127
SIMD::Multiply(all_as, AS {255}, all_as);
128128
SIMD::Min(all_as, InnerT {255}, all_as);
129129
SIMD::Max(all_as, InnerT {0}, all_as);
130-
SIMD::Convert<this->Default>(all_as, this->all);
130+
SIMD::Convert<Default>(all_as, this->all);
131131
}
132-
else SIMD::Convert<this->Default>(all_as, this->all);
132+
else SIMD::Convert<Default>(all_as, this->all);
133133
}
134134
return initialized > 0;
135135
}

0 commit comments

Comments
 (0)