summaryrefslogtreecommitdiff
path: root/10
diff options
context:
space:
mode:
Diffstat (limited to '10')
-rw-r--r--10/part2.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/10/part2.c b/10/part2.c
index 392cf0a..433c6ed 100644
--- a/10/part2.c
+++ b/10/part2.c
@@ -33,13 +33,14 @@ void insert_value_sorted(int *list, size_t *size, int value)
list[low] = value;
}
-uint64_t pos_seq(int *input, size_t input_size)
+uint64_t pos_seq(const int *input, size_t input_size)
{
- const static int TRIB[] = { 1, 1, 2, 4, 7 };
+ // Use char to optimize for size
+ const static char TRIB[] = { 1, 1, 2, 4, 7 };
int con = 0;
uint64_t res = 1;
- int *prev = input;
- int *cur = input + 1;
+ const int *prev = input;
+ const int *cur = input + 1;
do {
if (likely(*cur - *prev == 1)) {
con++;