Merge pull request #268 from lioncash/intconst

CIntElement: Remove const_cast
This commit is contained in:
Phillip Stephens 2020-03-23 23:29:26 -07:00 committed by GitHub
commit 00691c1175
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -189,12 +189,12 @@ bool CIESampleAndHold::GetValue(int frame, int& valOut) const {
int b, c;
xc_waitFramesMin->GetValue(frame, b);
x10_waitFramesMax->GetValue(frame, c);
/* const-correctness, who needs it? */
const_cast<CIESampleAndHold*>(this)->x8_nextSampleFrame = CRandom16::GetRandomNumber()->Range(b, c) + frame;
x8_nextSampleFrame = CRandom16::GetRandomNumber()->Range(b, c) + frame;
x4_sampleSource->GetValue(frame, valOut);
const_cast<CIESampleAndHold*>(this)->x14_holdVal = valOut;
} else
x14_holdVal = valOut;
} else {
valOut = x14_holdVal;
}
return false;
}

View File

@ -134,10 +134,10 @@ public:
class CIESampleAndHold : public CIntElement {
std::unique_ptr<CIntElement> x4_sampleSource;
int x8_nextSampleFrame = 0;
mutable int x8_nextSampleFrame = 0;
std::unique_ptr<CIntElement> xc_waitFramesMin;
std::unique_ptr<CIntElement> x10_waitFramesMax;
int x14_holdVal;
mutable int x14_holdVal;
public:
CIESampleAndHold(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b, std::unique_ptr<CIntElement>&& c)