mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-09-01 14:31:52 -06:00
fifo8: introduce head variable for fifo8_peekpop_bufptr()
Rather than operate on fifo->head directly, introduce a new head variable which is set to the value of fifo->head and use it instead. This is to allow future adjustment of the head position within the internal FIFO buffer. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: Octavian Purdila <tavip@google.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20240828122258.928947-3-mark.cave-ayland@ilande.co.uk> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
parent
f9309d965a
commit
0b73afec0e
1 changed files with 4 additions and 3 deletions
|
@ -75,11 +75,12 @@ static const uint8_t *fifo8_peekpop_bufptr(Fifo8 *fifo, uint32_t max,
|
||||||
uint32_t *numptr, bool do_pop)
|
uint32_t *numptr, bool do_pop)
|
||||||
{
|
{
|
||||||
uint8_t *ret;
|
uint8_t *ret;
|
||||||
uint32_t num;
|
uint32_t num, head;
|
||||||
|
|
||||||
assert(max > 0 && max <= fifo->num);
|
assert(max > 0 && max <= fifo->num);
|
||||||
num = MIN(fifo->capacity - fifo->head, max);
|
head = fifo->head;
|
||||||
ret = &fifo->data[fifo->head];
|
num = MIN(fifo->capacity - head, max);
|
||||||
|
ret = &fifo->data[head];
|
||||||
|
|
||||||
if (do_pop) {
|
if (do_pop) {
|
||||||
fifo->head += num;
|
fifo->head += num;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue