should't that be
int AbstractFifo::getFreeSpace() const noexcept { return bufferSize - getNumReady() - 1 ; }
should't that be
int AbstractFifo::getFreeSpace() const noexcept { return bufferSize - getNumReady() - 1 ; }
No... It should still work, even if you fill it right up, I think.. (?)
oh.. or maybe not.. I'll double-check that!
I apologise for resurrecting this topic, but I don’t understand why shouldn’t this return just bufferSize - getNumReady ()
?
For example if the fifo is empty this will return bufferSize - 1 (which is how I noticed it).
If i remember correctly, the fifo contains only a start and an end pointer, if start and end pointer have the equal value, we do not know if the fifo is full or empty. So we need at least 1 element difference.