aboutsummaryrefslogtreecommitdiff
path: root/src/FIFO.h
diff options
context:
space:
mode:
authorJesse Talavera <jesse@jesse.tg>2023-12-12 05:07:22 -0500
committerGitHub <noreply@github.com>2023-12-12 11:07:22 +0100
commit9bfc9c08ffe88de4b54734d6fd03182c0a51e181 (patch)
tree28a9177f377f6ab85f9aabc54c3a523fd7d610ff /src/FIFO.h
parent2cba2e783a2ef3a83b7d8bf0cb6e42a6298edbf6 (diff)
Sprinkle `const` around where appropriate (#1909)
* Sprinkle `const` around where appropriate - This will make it easier to use `NDS` objects in `const` contexts (e.g. `const` parameters or methods) * Remove the `const` qualifier on `DSi_DSP::DSPRead16` - MMIO reads can be non-pure, so this may not be `const` in the future
Diffstat (limited to 'src/FIFO.h')
-rw-r--r--src/FIFO.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/FIFO.h b/src/FIFO.h
index cbff4ab..026c2c7 100644
--- a/src/FIFO.h
+++ b/src/FIFO.h
@@ -74,12 +74,12 @@ public:
return ret;
}
- T Peek()
+ T Peek() const
{
return Entries[ReadPos];
}
- T Peek(u32 offset)
+ T Peek(u32 offset) const
{
u32 pos = ReadPos + offset;
if (pos >= NumEntries)
@@ -88,11 +88,11 @@ public:
return Entries[pos];
}
- u32 Level() { return NumOccupied; }
- bool IsEmpty() { return NumOccupied == 0; }
- bool IsFull() { return NumOccupied >= NumEntries; }
+ u32 Level() const { return NumOccupied; }
+ bool IsEmpty() const { return NumOccupied == 0; }
+ bool IsFull() const { return NumOccupied >= NumEntries; }
- bool CanFit(u32 num) { return ((NumOccupied + num) <= NumEntries); }
+ bool CanFit(u32 num) const { return ((NumOccupied + num) <= NumEntries); }
private:
T Entries[NumEntries] = {0};
@@ -164,12 +164,12 @@ public:
return ret;
}
- T Peek()
+ T Peek() const
{
return Entries[ReadPos];
}
- T Peek(u32 offset)
+ T Peek(u32 offset) const
{
u32 pos = ReadPos + offset;
if (pos >= NumEntries)
@@ -178,11 +178,11 @@ public:
return Entries[pos];
}
- u32 Level() { return NumOccupied; }
- bool IsEmpty() { return NumOccupied == 0; }
- bool IsFull() { return NumOccupied >= NumEntries; }
+ u32 Level() const { return NumOccupied; }
+ bool IsEmpty() const { return NumOccupied == 0; }
+ bool IsFull() const { return NumOccupied >= NumEntries; }
- bool CanFit(u32 num) { return ((NumOccupied + num) <= NumEntries); }
+ bool CanFit(u32 num) const { return ((NumOccupied + num) <= NumEntries); }
private:
u32 NumEntries;