Skip to content

Commit

Permalink
Merge pull request #156 from HNYuuu/fix-reverse
Browse files Browse the repository at this point in the history
fix reverse in array and deque
  • Loading branch information
Srđan Panić authored Oct 6, 2022
2 parents 73c468a + 2370067 commit 5285da8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/cc_array.c
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ void cc_array_reverse(CC_Array *ar)

size_t i;
size_t j;
for (i = 0, j = ar->size - 1; i < (ar->size - 1) / 2; i++, j--) {
for (i = 0, j = ar->size - 1; i < ar->size / 2; i++, j--) {
void *tmp = ar->buffer[i];
ar->buffer[i] = ar->buffer[j];
ar->buffer[j] = tmp;
Expand Down
2 changes: 1 addition & 1 deletion src/cc_deque.c
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ void cc_deque_reverse(CC_Deque *deque)

size_t first = deque->first;

for (i = 0, j = s - 1; i < (s - 1) / 2; i++, j--) {
for (i = 0, j = s - 1; i < s / 2; i++, j--) {
size_t f = (first + i) & c;
size_t l = (first + j) & c;

Expand Down

0 comments on commit 5285da8

Please sign in to comment.