Fixed: Invalid array access. Crash in gcc with aggressive loop optimizations enabled.

--HG--
branch : patches-from-atys
hg/hotfix/patches-from-atys
Nimetu 5 years ago
parent 249ce945f1
commit ddd0a7507e

@ -88,9 +88,9 @@ I16x16Layer *I16x16Layer::compress(I16x16Layer *layer, sint32 blank)
map<sint32, uint> count;
for (i=0; i<256; ++i)
for (i=0; i<16; ++i) for (j=0;j<16;++j)
{
sint32 val = flayer->Array[0][i];
sint32 val = flayer->Array[i][j];
if (val == blank)
continue;

@ -141,7 +141,11 @@ public:
void set(uint i, uint j, sint value) { nlassert(i<16 && j<16); Array[i][j] = value; }
protected:
void serial(NLMISC::IStream &f) { for (uint i=0; i<16*16; ++i) f.serial(Array[0][i]); }
void serial(NLMISC::IStream &f) {
for (uint i=0; i<16; ++i)
for (uint j=0; j<16; ++j)
f.serial(Array[i][j]);
}
};
/**
@ -166,8 +170,9 @@ protected:
void serial(NLMISC::IStream &f)
{
f.serial(Mean);
for (uint i=0; i<16*16; ++i)
f.serial(Array[0][i]);
for (uint i=0; i<16; ++i)
for(uint j=0; j<16; ++j)
f.serial(Array[i][j]);
}
};
@ -193,8 +198,9 @@ protected:
void serial(NLMISC::IStream &f)
{
f.serial(Mean);
for (uint i=0; i<16*2; ++i)
f.serial(Array[0][i]);
for (uint i=0; i<16; ++i)
for (uint j=0; j<2; ++j)
f.serial(Array[i][j]);
}
};

Loading…
Cancel
Save