Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/86dregyz4/circular queue #7

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

ErnestWang31
Copy link
Contributor

No description provided.

@ErnestWang31 ErnestWang31 self-assigned this Mar 6, 2024
.DS_Store Outdated
Copy link
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

.idea/vcs.xml Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

delete

Copy link
Contributor

Choose a reason for hiding this comment

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

delete

Common/.DS_Store Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

delete

#include "circ_queue.h"

// Function to increment head pointer
void inc_head(Queue_t *self) {
Copy link
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

// Function to increment tail pointer
void inc_tail(Queue_t *self) {
if (++self->_tail == self->_arr + BUFF_SIZE) {
self->_tail = self->_arr;
Copy link
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

Queue_t queue_init() {
Queue_t ret = {
.len = 0,
._head = 0,
Copy link
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

*self->_tail = frame;
inc_tail(self);
if (self->len > 0) {
inc_tail(self);
Copy link
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.

current = self->_arr;
}
}
}
Copy link
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