From 6dbdb966fc987bd3145b797d5d6104e467cdea15 Mon Sep 17 00:00:00 2001 From: Stefan Kalkowski Date: Mon, 13 Dec 2021 15:41:58 +0100 Subject: [PATCH] virtio: remove bitfield in Index template Eliminates note of GCC about bitfield as parameter semantic change. Ref #4344 --- repos/os/src/server/vmm/virtio_device.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/repos/os/src/server/vmm/virtio_device.h b/repos/os/src/server/vmm/virtio_device.h index 1185439dee..6fe06bb259 100644 --- a/repos/os/src/server/vmm/virtio_device.h +++ b/repos/os/src/server/vmm/virtio_device.h @@ -48,13 +48,17 @@ class Vmm::Virtio_split_queue { private: - unsigned _idx : LOG2; + uint16_t _idx; + + static_assert((sizeof(uint16_t)*8) >= LOG2); public: Index(unsigned idx = 0) : _idx(idx % (1 << LOG2)) {} - void inc() { _idx++; } + void inc() { + _idx = ((_idx + 1) % (1 << LOG2)); } + unsigned idx() const { return _idx; } bool operator != (Index const & o) const {