diff options
| author | Bond_009 <bond.009@outlook.com> | 2020-12-10 16:31:26 +0100 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2020-12-10 16:31:26 +0100 |
| commit | 42f6accc9bb83aef2f1a6063a3ca44b70453ef8e (patch) | |
| tree | d1d1bf40346a7519a909dde3a2499e571b191088 /10/part2.c | |
| parent | 62c8a6c887809641c4fd6f21cd24b0b26aae48e8 (diff) | |
Minor improvements day 10
Diffstat (limited to '10/part2.c')
| -rw-r--r-- | 10/part2.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -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++; |
