We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3e1c9d8 commit 943f418Copy full SHA for 943f418
lfbb/src/lfbb.c
@@ -82,7 +82,7 @@ uint8_t *LFBB_WriteAcquire(LFBB_Inst_Type *inst, const size_t free_required) {
82
const size_t size = inst->size;
83
84
const size_t free = CalcFree(w, r, size);
85
- const size_t linear_space = size - r;
+ const size_t linear_space = size - w;
86
const size_t linear_free = MIN(free, linear_space);
87
88
/* Try to find enough linear space until the end of the buffer */
@@ -116,6 +116,7 @@ void LFBB_WriteRelease(LFBB_Inst_Type *inst, const size_t written) {
116
}
117
118
/* Increment the write index */
119
+ assert(w + written <= inst->size);
120
w += written;
121
122
/* If we wrote over invalidated parts of the buffer move the invalidate
0 commit comments