diff options
Diffstat (limited to 'app/platform/stm32f0-gcc/ring_buffer.h')
-rw-r--r-- | app/platform/stm32f0-gcc/ring_buffer.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/app/platform/stm32f0-gcc/ring_buffer.h b/app/platform/stm32f0-gcc/ring_buffer.h index 1a065ef..ae4d99d 100644 --- a/app/platform/stm32f0-gcc/ring_buffer.h +++ b/app/platform/stm32f0-gcc/ring_buffer.h @@ -20,7 +20,11 @@ public: } constexpr void Push(const UnitType *items, size_t nitems) { - if (items) for (; nitems; items++, nitems--) Push(*items); + if (items) { + for (size_t i = 0; i < nitems; i++) { + Push(items[i]); + } + } } constexpr UnitType Pop() { @@ -30,7 +34,11 @@ public: } constexpr void Pop(UnitType* buf, size_t nitems) { - if (buf) for (; nitems; nitems--, buf++) *buf = Pop(); + if (buf) { + for (size_t i = 0; i < nitems; i++) { + buf[i] = Pop(); + } + } } constexpr size_t Free() { |