mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-28 02:41:18 +00:00
Mark some functions as const
This commit is contained in:
parent
f7baec317c
commit
a962bc5a6c
@ -748,7 +748,7 @@ void ARMXEmitter::B(ARMReg src)
|
||||
Write32(condition | 0x012FFF10 | src);
|
||||
}
|
||||
|
||||
bool ARMXEmitter::BLInRange(const void *fnptr) {
|
||||
bool ARMXEmitter::BLInRange(const void *fnptr) const {
|
||||
ptrdiff_t distance = (intptr_t)fnptr - (intptr_t(code) + 8);
|
||||
if (distance <= -0x2000000 || distance > 0x2000000)
|
||||
return false;
|
||||
|
@ -143,7 +143,7 @@ private:
|
||||
u8 IndexOrShift;
|
||||
ShiftType Shift;
|
||||
public:
|
||||
OpType GetType()
|
||||
OpType GetType() const
|
||||
{
|
||||
return Type;
|
||||
}
|
||||
@ -240,35 +240,35 @@ public:
|
||||
_assert_msg_(JIT, Type == TYPE_RSR, "RSR must be RSR Of Course");
|
||||
return (IndexOrShift << 8) | (Shift << 5) | 0x10 | Value;
|
||||
}
|
||||
u32 Rm()
|
||||
u32 Rm() const
|
||||
{
|
||||
_assert_msg_(JIT, Type == TYPE_REG, "Rm must be with Reg");
|
||||
return Value;
|
||||
}
|
||||
|
||||
u32 Imm5()
|
||||
u32 Imm5() const
|
||||
{
|
||||
_assert_msg_(JIT, (Type == TYPE_IMM), "Imm5 not IMM value");
|
||||
return ((Value & 0x0000001F) << 7);
|
||||
}
|
||||
u32 Imm8()
|
||||
u32 Imm8() const
|
||||
{
|
||||
_assert_msg_(JIT, (Type == TYPE_IMM), "Imm8Rot not IMM value");
|
||||
return Value & 0xFF;
|
||||
}
|
||||
u32 Imm8Rot() // IMM8 with Rotation
|
||||
u32 Imm8Rot() const // IMM8 with Rotation
|
||||
{
|
||||
_assert_msg_(JIT, (Type == TYPE_IMM), "Imm8Rot not IMM value");
|
||||
_assert_msg_(JIT, (Rotation & 0xE1) != 0, "Invalid Operand2: immediate rotation %u", Rotation);
|
||||
return (1 << 25) | (Rotation << 7) | (Value & 0x000000FF);
|
||||
}
|
||||
u32 Imm12()
|
||||
u32 Imm12() const
|
||||
{
|
||||
_assert_msg_(JIT, (Type == TYPE_IMM), "Imm12 not IMM");
|
||||
return (Value & 0x00000FFF);
|
||||
}
|
||||
|
||||
u32 Imm12Mod()
|
||||
u32 Imm12Mod() const
|
||||
{
|
||||
// This is an IMM12 with the top four bits being rotation and the
|
||||
// bottom eight being an IMM. This is for instructions that need to
|
||||
@ -278,32 +278,32 @@ public:
|
||||
_assert_msg_(JIT, (Type == TYPE_IMM), "Imm12Mod not IMM");
|
||||
return ((Rotation & 0xF) << 8) | (Value & 0xFF);
|
||||
}
|
||||
u32 Imm16()
|
||||
u32 Imm16() const
|
||||
{
|
||||
_assert_msg_(JIT, (Type == TYPE_IMM), "Imm16 not IMM");
|
||||
return ( (Value & 0xF000) << 4) | (Value & 0x0FFF);
|
||||
}
|
||||
u32 Imm16Low()
|
||||
u32 Imm16Low() const
|
||||
{
|
||||
return Imm16();
|
||||
}
|
||||
u32 Imm16High() // Returns high 16bits
|
||||
u32 Imm16High() const // Returns high 16bits
|
||||
{
|
||||
_assert_msg_(JIT, (Type == TYPE_IMM), "Imm16 not IMM");
|
||||
return ( ((Value >> 16) & 0xF000) << 4) | ((Value >> 16) & 0x0FFF);
|
||||
}
|
||||
u32 Imm24()
|
||||
u32 Imm24() const
|
||||
{
|
||||
_assert_msg_(JIT, (Type == TYPE_IMM), "Imm16 not IMM");
|
||||
return (Value & 0x0FFFFFFF);
|
||||
}
|
||||
// NEON and ASIMD specific
|
||||
u32 Imm8ASIMD()
|
||||
u32 Imm8ASIMD() const
|
||||
{
|
||||
_assert_msg_(JIT, (Type == TYPE_IMM), "Imm8ASIMD not IMM");
|
||||
return ((Value & 0x80) << 17) | ((Value & 0x70) << 12) | (Value & 0xF);
|
||||
}
|
||||
u32 Imm8VFP()
|
||||
u32 Imm8VFP() const
|
||||
{
|
||||
_assert_msg_(JIT, (Type == TYPE_IMM), "Imm8VFP not IMM");
|
||||
return ((Value & 0xF0) << 12) | (Value & 0xF);
|
||||
@ -511,7 +511,7 @@ public:
|
||||
void B (ARMReg src);
|
||||
void BL(const void *fnptr);
|
||||
void BL(ARMReg src);
|
||||
bool BLInRange(const void *fnptr);
|
||||
bool BLInRange(const void *fnptr) const;
|
||||
|
||||
void PUSH(const int num, ...);
|
||||
void POP(const int num, ...);
|
||||
|
@ -75,7 +75,7 @@ public:
|
||||
return buf_;
|
||||
}
|
||||
|
||||
size_t size() {
|
||||
size_t size() const {
|
||||
return size_;
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ void Timer::Update()
|
||||
// -------------------------------------
|
||||
|
||||
// Get the number of milliseconds since the last Update()
|
||||
u64 Timer::GetTimeDifference()
|
||||
u64 Timer::GetTimeDifference() const
|
||||
{
|
||||
return GetTimeMs() - m_LastTime;
|
||||
}
|
||||
@ -112,7 +112,7 @@ void Timer::WindBackStartingTime(u64 WindBack)
|
||||
}
|
||||
|
||||
// Get the time elapsed since the Start()
|
||||
u64 Timer::GetTimeElapsed()
|
||||
u64 Timer::GetTimeElapsed() const
|
||||
{
|
||||
// If we have not started yet, return 1 (because then I don't
|
||||
// have to change the FPS calculation in CoreRerecording.cpp .
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
void Update();
|
||||
|
||||
// The time difference is always returned in milliseconds, regardless of alternative internal representation
|
||||
u64 GetTimeDifference();
|
||||
u64 GetTimeDifference() const;
|
||||
void AddTimeDifference();
|
||||
void WindBackStartingTime(u64 WindBack);
|
||||
|
||||
@ -45,7 +45,7 @@ public:
|
||||
|
||||
static void GetTimeFormatted(char formattedTime[13]);
|
||||
std::string GetTimeElapsedFormatted() const;
|
||||
u64 GetTimeElapsed();
|
||||
u64 GetTimeElapsed() const;
|
||||
|
||||
static u32 GetTimeMs();
|
||||
|
||||
|
@ -84,7 +84,7 @@ private:
|
||||
ReadFunc Read;
|
||||
CloseFunc Close;
|
||||
|
||||
bool IsValid() { return library != NULL; }
|
||||
bool IsValid() const { return library != NULL; }
|
||||
};
|
||||
|
||||
struct HandlerFileHandle {
|
||||
|
@ -170,7 +170,7 @@ public:
|
||||
void setStreamNum(int num);
|
||||
bool setStreamWithType(int type, int channel);
|
||||
|
||||
int FindEPWithTimestamp(int pts);
|
||||
int FindEPWithTimestamp(int pts) const;
|
||||
|
||||
u32 magic;
|
||||
u32 version;
|
||||
@ -548,7 +548,7 @@ bool Psmf::setStreamWithType(int type, int channel) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int Psmf::FindEPWithTimestamp(int pts) {
|
||||
int Psmf::FindEPWithTimestamp(int pts) const {
|
||||
int best = -1;
|
||||
int bestPts = 0;
|
||||
|
||||
|
@ -41,7 +41,7 @@ void PpcRegCache::Start(MIPSAnalyst::AnalysisResults &stats) {
|
||||
}
|
||||
}
|
||||
|
||||
const PPCReg *PpcRegCache::GetMIPSAllocationOrder(int &count) {
|
||||
const PPCReg *PpcRegCache::GetMIPSAllocationOrder(int &count) const {
|
||||
// Note that R0 is reserved as scratch for now.
|
||||
// R1 could be used as it's only used for scratch outside "regalloc space" now.
|
||||
// R12 is also potentially usable.
|
||||
|
@ -139,8 +139,8 @@ public:
|
||||
int GetMipsRegOffset(MIPSReg r);
|
||||
|
||||
private:
|
||||
const PPCReg *GetMIPSAllocationOrder(int &count);
|
||||
|
||||
const PPCReg *GetMIPSAllocationOrder(int &count) const;
|
||||
|
||||
MIPSState *mips_;
|
||||
MIPSComp::PpcJitOptions *options_;
|
||||
PPCXEmitter *emit_;
|
||||
|
@ -41,7 +41,7 @@ void PpcRegCacheVPU::Start(MIPSAnalyst::AnalysisResults &stats) {
|
||||
}
|
||||
}
|
||||
|
||||
const PPCReg *PpcRegCacheVPU::GetMIPSAllocationOrder(int &count) {
|
||||
const PPCReg *PpcRegCacheVPU::GetMIPSAllocationOrder(int &count) const {
|
||||
// Note that R0 is reserved as scratch for now.
|
||||
// R1 could be used as it's only used for scratch outside "regalloc space" now.
|
||||
// R12 is also potentially usable.
|
||||
|
@ -89,8 +89,8 @@ public:
|
||||
int GetMipsRegOffset(MIPSReg r);
|
||||
|
||||
private:
|
||||
const PPCReg *GetMIPSAllocationOrder(int &count);
|
||||
|
||||
const PPCReg *GetMIPSAllocationOrder(int &count) const;
|
||||
|
||||
MIPSState *mips_;
|
||||
MIPSComp::PpcJitOptions *options_;
|
||||
PPCXEmitter *emit_;
|
||||
|
@ -45,7 +45,7 @@ bool IndexGenerator::PrimCompatible(int prim1, int prim2) {
|
||||
return indexedPrimitiveType[prim1] == indexedPrimitiveType[prim2];
|
||||
}
|
||||
|
||||
bool IndexGenerator::PrimCompatible(int prim) {
|
||||
bool IndexGenerator::PrimCompatible(int prim) const {
|
||||
if (prim_ == GE_PRIM_INVALID)
|
||||
return true;
|
||||
return indexedPrimitiveType[prim] == prim_;
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
void Setup(u16 *indexptr);
|
||||
void Reset();
|
||||
static bool PrimCompatible(int prim1, int prim2);
|
||||
bool PrimCompatible(int prim);
|
||||
bool PrimCompatible(int prim) const;
|
||||
GEPrimitiveType Prim() const { return prim_; }
|
||||
|
||||
void AddPrim(int prim, int vertexCount);
|
||||
|
@ -276,13 +276,13 @@ struct GPUgstate
|
||||
|
||||
// Alpha Test
|
||||
bool isAlphaTestEnabled() const { return alphaTestEnable & 1; }
|
||||
GEComparison getAlphaTestFunction() { return static_cast<GEComparison>(alphatest & 0x7); }
|
||||
GEComparison getAlphaTestFunction() const { return static_cast<GEComparison>(alphatest & 0x7); }
|
||||
int getAlphaTestRef() const { return (alphatest >> 8) & 0xFF; }
|
||||
int getAlphaTestMask() const { return (alphatest >> 16) & 0xFF; }
|
||||
|
||||
// Color Test
|
||||
bool isColorTestEnabled() const { return colorTestEnable & 1; }
|
||||
GEComparison getColorTestFunction() { return static_cast<GEComparison>(colortest & 0x3); }
|
||||
GEComparison getColorTestFunction() const { return static_cast<GEComparison>(colortest & 0x3); }
|
||||
u32 getColorTestRef() const { return colorref & 0xFFFFFF; }
|
||||
u32 getColorTestMask() const { return colortestmask & 0xFFFFFF; }
|
||||
|
||||
@ -305,7 +305,7 @@ struct GPUgstate
|
||||
u32 getClutAddress() const { return (clutaddr & 0x00FFFFFF) | ((clutaddrupper << 8) & 0x0F000000); }
|
||||
int getClutLoadBytes() const { return (loadclut & 0x3F) * 32; }
|
||||
int getClutLoadBlocks() const { return (loadclut & 0x3F); }
|
||||
GEPaletteFormat getClutPaletteFormat() { return static_cast<GEPaletteFormat>(clutformat & 3); }
|
||||
GEPaletteFormat getClutPaletteFormat() const { return static_cast<GEPaletteFormat>(clutformat & 3); }
|
||||
int getClutIndexShift() const { return (clutformat >> 2) & 0x1F; }
|
||||
int getClutIndexMask() const { return (clutformat >> 8) & 0xFF; }
|
||||
int getClutIndexStartPos() const { return ((clutformat >> 16) & 0x1F) << 4; }
|
||||
|
Loading…
Reference in New Issue
Block a user