diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-01-22 10:48:21 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-01-22 11:14:36 +0100 |
| commit | 2e79b4ac22321abd69c7f1a9748b5761abaab1ec (patch) | |
| tree | e7f3cb04aa24ddb39fa2ae7418aac3a69f7fe791 /src/common/stack_core.c | |
| parent | 6a83ee598406e9ee4bdd7169dfc4bb46284a2062 (diff) | |
| download | push_swap-2e79b4ac22321abd69c7f1a9748b5761abaab1ec.tar.gz push_swap-2e79b4ac22321abd69c7f1a9748b5761abaab1ec.tar.bz2 push_swap-2e79b4ac22321abd69c7f1a9748b5761abaab1ec.zip | |
Added micro optimisation when sorting frame == 2 and less reverse rotate when frame == full stack, norming
Diffstat (limited to 'src/common/stack_core.c')
| -rw-r--r-- | src/common/stack_core.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/common/stack_core.c b/src/common/stack_core.c index bf766d4..adab5b1 100644 --- a/src/common/stack_core.c +++ b/src/common/stack_core.c @@ -6,13 +6,13 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/01/19 06:37:45 by cacharle #+# #+# */ -/* Updated: 2020/01/19 13:33:08 by cacharle ### ########.fr */ +/* Updated: 2020/01/22 10:23:18 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ #include "common.h" -t_stack *stack_new(int size) +t_stack *stack_new(int size) { t_stack *stack; @@ -28,7 +28,7 @@ t_stack *stack_new(int size) return (stack); } -void stack_destroy(t_stack *stack) +void stack_destroy(t_stack *stack) { if (stack == NULL) return ; @@ -36,20 +36,20 @@ void stack_destroy(t_stack *stack) free(stack); } -void stack_push(t_stack *stack, int n) +void stack_push(t_stack *stack, int n) { stack->top++; stack->elements[stack->top] = n; } -void stack_pop(t_stack *stack) +void stack_pop(t_stack *stack) { if (stack_empty(stack)) return ; stack->top--; } -int stack_peek(t_stack *stack) +int stack_peek(t_stack *stack) { if (stack_empty(stack)) return (0); |
