Fix build break for non-VS.

This commit is contained in:
John Kessenich 2017-01-13 20:22:00 -07:00
parent 442515393e
commit 33dadd1287
4 changed files with 11 additions and 10 deletions

View file

@ -443,7 +443,7 @@ void TParseContextBase::parseSwizzleSelector(const TSourceLoc& loc, const TStrin
TSwizzleSelectors<TVectorSelector>& selector)
{
// Too long?
if (compString.size() > TSwizzleSelectors<TVectorSelector>::maxSelectors)
if (compString.size() > MaxSwizzleSelectors)
error(loc, "vector swizzle too long", compString.c_str(), "");
// Use this to test that all swizzle characters are from the same swizzle-namespace-set
@ -451,10 +451,10 @@ void TParseContextBase::parseSwizzleSelector(const TSourceLoc& loc, const TStrin
exyzw,
ergba,
estpq,
} fieldSet[TSwizzleSelectors<TVectorSelector>::maxSelectors];
} fieldSet[MaxSwizzleSelectors];
// Decode the swizzle string.
int size = std::min(TSwizzleSelectors<TVectorSelector>::maxSelectors, (int)compString.size());
int size = std::min(MaxSwizzleSelectors, (int)compString.size());
for (int i = 0; i < size; ++i) {
switch (compString[i]) {
case 'x':

View file

@ -54,15 +54,16 @@ struct TMatrixSelector {
typedef int TVectorSelector;
const int MaxSwizzleSelectors = 4;
template<typename selectorType>
class TSwizzleSelectors {
public:
static const int maxSelectors = 4;
TSwizzleSelectors() : size_(0) { }
void push_back(selectorType comp)
{
if (size_ < maxSelectors)
if (size_ < MaxSwizzleSelectors)
components[size_++] = comp;
}
void resize(int s)
@ -73,13 +74,13 @@ public:
int size() const { return size_; }
selectorType operator[](int i) const
{
assert(i < maxSelectors);
assert(i < MaxSwizzleSelectors);
return components[i];
}
private:
int size_;
selectorType components[maxSelectors];
selectorType components[MaxSwizzleSelectors];
};
//