Int AbstractFifo::getFreeSpace()


#1

should't that be

int AbstractFifo::getFreeSpace() const noexcept          
{
   return bufferSize - getNumReady() - 1 ;
}

#2

No... It should still work, even if you fill it right up, I think.. (?)


#3

oh.. or maybe not.. I'll double-check that!


#4

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).


#5

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.