summaryrefslogtreecommitdiff
path: root/10
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2020-12-10 16:31:26 +0100
committerBond_009 <bond.009@outlook.com>2020-12-10 16:31:26 +0100
commit42f6accc9bb83aef2f1a6063a3ca44b70453ef8e (patch)
treed1d1bf40346a7519a909dde3a2499e571b191088 /10
parent62c8a6c887809641c4fd6f21cd24b0b26aae48e8 (diff)
Minor improvements day 10
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++;