From 69f0fedd66b3fa51183a6fbf95c449405c93e01c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Sat, 5 Oct 2024 01:41:10 +0200 Subject: [PATCH] v0.0.524 --- dataext/ringBuffer.go | 6 ++++++ goextVersion.go | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dataext/ringBuffer.go b/dataext/ringBuffer.go index 2697848..bb1b311 100644 --- a/dataext/ringBuffer.go +++ b/dataext/ringBuffer.go @@ -61,6 +61,9 @@ func (rb *RingBuffer[T]) At(i int) T { if i < 0 || i >= rb.size { panic("Index out of bounds") } + if rb.size < rb.capacity { + return rb.items[i] + } return rb.items[(rb.head+i)%rb.capacity] } @@ -68,6 +71,9 @@ func (rb *RingBuffer[T]) Get(i int) (T, bool) { if i < 0 || i >= rb.size { return *new(T), false } + if rb.size < rb.capacity { + return rb.items[i], true + } return rb.items[(rb.head+i)%rb.capacity], true } diff --git a/goextVersion.go b/goextVersion.go index b099fd4..0cb9a20 100644 --- a/goextVersion.go +++ b/goextVersion.go @@ -1,5 +1,5 @@ package goext -const GoextVersion = "0.0.523" +const GoextVersion = "0.0.524" -const GoextVersionTimestamp = "2024-10-05T01:28:46+0200" +const GoextVersionTimestamp = "2024-10-05T01:41:10+0200"