Simplify SimpleFIFO

This commit is contained in:
twinaphex 2020-10-15 07:45:57 +02:00
parent b014d46aec
commit 611e379c04
4 changed files with 6 additions and 34 deletions

View File

@ -172,7 +172,7 @@ ifeq ($(HAVE_CHD), 1)
INCFLAGS += $(shell pkg-config --cflags zlib)
LIBS += $(shell pkg-config --libs zlib)
else
INCFLAGS += $(ZLIB_INCFLAGS)
INCFLAGS += $(ZLIB_INCFLAGS)
SOURCES_C += $(ZLIB_SOURCES_C)
endif

View File

@ -30,24 +30,14 @@ class SimpleFIFO
return(size - in_count);
}
INLINE uint8_t ReadUnit(bool peek = false)
INLINE uint8_t ReadUnit(void)
{
uint8_t ret = data[read_pos];
if(!peek)
{
read_pos = (read_pos + 1) & (size - 1);
in_count--;
}
read_pos = (read_pos + 1) & (size - 1);
in_count--;
return(ret);
}
INLINE uint8_t ReadByte(bool peek = false)
{
return(ReadUnit(peek));
}
INLINE void Write(const uint8_t *happy_data, uint32 happy_count)
{
while(happy_count)
@ -61,17 +51,6 @@ class SimpleFIFO
}
}
INLINE void WriteUnit(const uint8_t& wr_data)
{
Write(&wr_data, 1);
}
INLINE void WriteByte(const uint8_t& wr_data)
{
Write(&wr_data, 1);
}
INLINE void Flush(void)
{
read_pos = 0;
@ -79,13 +58,6 @@ class SimpleFIFO
in_count = 0;
}
INLINE void SaveStatePostLoad(void)
{
read_pos %= size;
write_pos %= size;
in_count %= (size + 1);
}
uint8_t *data;
uint32 size;
uint32 read_pos; // Read position

View File

@ -403,7 +403,7 @@ uint8 PCECD_Read(uint32 timestamp, uint32 A)
case 0x7:
if(SubChannelFIFO.in_count > 0)
ret = SubChannelFIFO.ReadByte();
ret = SubChannelFIFO.ReadUnit();
else
ret = 0x00; // Not sure if it's 0, 0xFF, the last byte read, or something else.

View File

@ -1142,7 +1142,7 @@ uint32 PCECD_Drive_Run(pcecd_drive_timestamp_t system_timestamp)
}
else
{
cd_bus.DB = din.ReadByte();
cd_bus.DB = din.ReadUnit();
SetREQ(TRUE);
}
}