Fix MIP Q

This commit is contained in:
Sergio R. Caprile committed 2022-09-07 14:59:58 -03:00
1 parent 75892cb523
commit 9675bfe07d
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -180,7 +180,7 @@ static void q_copyout(struct queue *q, uint8_t *buf, size_t len, size_t tail) {
static bool q_write(struct queue *q, const void *buf, size_t len) {
bool success = false;
size_t left = q->len - q->head + q->tail;
size_t left = (q->len - q->head + q->tail -1) % q->len;
if (len + sizeof(size_t) <= left) {
q_copyin(q, (uint8_t *) &len, sizeof(len), q->head);
q_copyin(q, (uint8_t *) buf, len, (q->head + sizeof(size_t)) % q->len);
+1 -1
View File
@@ -6469,7 +6469,7 @@ static void q_copyout(struct queue *q, uint8_t *buf, size_t len, size_t tail) {
static bool q_write(struct queue *q, const void *buf, size_t len) {
bool success = false;
size_t left = q->len - q->head + q->tail;
size_t left = (q->len - q->head + q->tail -1) % q->len;
if (len + sizeof(size_t) <= left) {
q_copyin(q, (uint8_t *) &len, sizeof(len), q->head);
q_copyin(q, (uint8_t *) buf, len, (q->head + sizeof(size_t)) % q->len);