From 8cb96f9f42320669deaacca4b0dc7eb8b2f6b783 Mon Sep 17 00:00:00 2001 From: Cuda-Chen Date: Tue, 24 Dec 2024 20:51:38 +0800 Subject: [PATCH] Fix modulation --- virtio-snd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/virtio-snd.c b/virtio-snd.c index 717ee7e..d28d199 100644 --- a/virtio-snd.c +++ b/virtio-snd.c @@ -623,7 +623,7 @@ static void __virtio_snd_frame_dequeue(void *out, /* Copy the frame to output stream */ uint32_t size = props->ring.cons.size; - uint32_t idx = cons_head & mask; + uint32_t idx = cons_head % size; fprintf(stderr, "cons_head %" PRIu32 " cons_next %" PRIu32 " mask %" PRIu32 " idx %" PRIu32 "\n", @@ -810,7 +810,7 @@ static void __virtio_snd_frame_enqueue(void *payload, /* Write payload to ring buffer. */ uint32_t size = props->ring.prod.size; - uint32_t idx = prod_head & mask; + uint32_t idx = prod_head % size; fprintf(stderr, "prod_head %" PRIu32 " prod_next %" PRIu32 " mask %" PRIu32 " idx %" PRIu32 "\n",