diff options
Diffstat (limited to 'core/ring_buffer.h')
-rw-r--r-- | core/ring_buffer.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/core/ring_buffer.h b/core/ring_buffer.h index 2516880064..54486f8cad 100644 --- a/core/ring_buffer.h +++ b/core/ring_buffer.h @@ -135,6 +135,12 @@ public: return p_n; }; + inline int decrease_write(int p_n) { + p_n = MIN(p_n, data_left()); + inc(write_pos, size_mask + 1 - p_n); + return p_n; + } + Error write(const T &p_v) { ERR_FAIL_COND_V(space_left() < 1, FAILED); data.write[inc(write_pos, 1)] = p_v; |