Skip to content

Feature/86dregyz4/circular queue#7

Open
ErnestWang31 wants to merge 5 commits into
developfrom
feature/86dregyz4/circular-queue
Open

Feature/86dregyz4/circular queue#7
ErnestWang31 wants to merge 5 commits into
developfrom
feature/86dregyz4/circular-queue

Conversation

@ErnestWang31

Copy link
Copy Markdown
Contributor

No description provided.

@ErnestWang31 ErnestWang31 self-assigned this Mar 6, 2024
Comment thread .DS_Store Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete files added to .gitignore in develop

Comment thread .idea/vcs.xml Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete

Comment thread .idea/workspace.xml Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete

Comment thread Common/.DS_Store Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete

Comment thread Common/Src/circ_queue.c Outdated
#include "circ_queue.h"

// Function to increment head pointer
void inc_head(Queue_t *self) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make these two increment functions static if they only need to be accessed in this .c file

Comment thread Common/Src/circ_queue.c
// Function to increment tail pointer
void inc_tail(Queue_t *self) {
if (++self->_tail == self->_arr + BUFF_SIZE) {
self->_tail = self->_arr;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_head and _tail aren't defined as pointers

Comment thread Common/Src/circ_queue.c Outdated
Queue_t queue_init() {
Queue_t ret = {
.len = 0,
._head = 0,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set _head and _tail to _arr to start

Comment thread Common/Src/circ_queue.c Outdated
*self->_tail = frame;
inc_tail(self);
if (self->len > 0) {
inc_tail(self);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does it increment twice if (len == 0)? I think you had the right logic before.

Comment thread Common/Src/circ_queue.c Outdated
current = self->_arr;
}
}
} No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a newline at the end of both files

@mahir-mahota mahir-mahota changed the base branch from master to develop March 29, 2024 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants