pcm/Dsd2Pcm: use sizet_t instead of unsigned

This commit is contained in:
Max Kellermann
2020-01-14 22:37:30 +01:00
parent 1708ae3e3c
commit bc5b647053
2 changed files with 5 additions and 5 deletions

View File

@@ -162,10 +162,10 @@ Dsd2Pcm::Reset() noexcept
} }
inline float inline float
Dsd2Pcm::CalcOutputSample(unsigned ffp) const noexcept Dsd2Pcm::CalcOutputSample(size_t ffp) const noexcept
{ {
double acc = 0; double acc = 0;
for (unsigned i = 0; i < CTABLES; ++i) { for (size_t i = 0; i < CTABLES; ++i) {
unsigned bite1 = fifo[(ffp -i) & FIFOMASK] & 0xFF; unsigned bite1 = fifo[(ffp -i) & FIFOMASK] & 0xFF;
unsigned bite2 = fifo[(ffp-(CTABLES*2-1)+i) & FIFOMASK] & 0xFF; unsigned bite2 = fifo[(ffp-(CTABLES*2-1)+i) & FIFOMASK] & 0xFF;
acc += ctables[i][bite1] + ctables[i][bite2]; acc += ctables[i][bite1] + ctables[i][bite2];
@@ -179,7 +179,7 @@ Dsd2Pcm::Translate(size_t samples,
bool lsbf, bool lsbf,
float *dst, ptrdiff_t dst_stride) noexcept float *dst, ptrdiff_t dst_stride) noexcept
{ {
unsigned ffp = fifopos; size_t ffp = fifopos;
while (samples-- > 0) { while (samples-- > 0) {
unsigned bite1 = *src & 0xFFu; unsigned bite1 = *src & 0xFFu;
if (lsbf) bite1 = bit_reverse(bite1); if (lsbf) bite1 = bit_reverse(bite1);

View File

@@ -47,7 +47,7 @@ private:
static constexpr size_t FIFOMASK = FIFOSIZE - 1; static constexpr size_t FIFOMASK = FIFOSIZE - 1;
uint8_t fifo[FIFOSIZE]; uint8_t fifo[FIFOSIZE];
unsigned fifopos; size_t fifopos;
public: public:
Dsd2Pcm() noexcept { Dsd2Pcm() noexcept {
@@ -76,7 +76,7 @@ public:
float *dst, ptrdiff_t dst_stride) noexcept; float *dst, ptrdiff_t dst_stride) noexcept;
private: private:
float CalcOutputSample(unsigned ffp) const noexcept; float CalcOutputSample(size_t ffp) const noexcept;
}; };
#endif /* include guard DSD2PCM_H_INCLUDED */ #endif /* include guard DSD2PCM_H_INCLUDED */