Advent of Code

Diff
Login

Diff

Differences From Artifact [a0c4f0a95c]:

To Artifact [1f637ca7e2]:


1
2
3
4
5
6
7
8
9
10











11
12
13
14
15
16
17
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28










+
+
+
+
+
+
+
+
+
+
+







#ifndef AOCUTILS_H_INCLUDED
#define AOCUTILS_H_INCLUDED

#include <stdbool.h>

struct TextGrid {
    unsigned cols, rows;
    char *data; // may have '\n' at end of rows
};

struct RectangularMap {
    int cols, rows;
    char *data;
};
char RMcharat(struct RectangularMap *sm, int col, int row);
char *RMcharptr(struct RectangularMap *sm, int col, int row);
void RMcopy(struct RectangularMap *restrict dst,
            const struct RectangularMap *restrict src);
void RMaddline(struct RectangularMap *sm, const char *lin);
void RMfree(struct RectangularMap *sm);

long long unsigned upow(unsigned base, unsigned exponent);

void md5mini(unsigned char *dstarr, const char *src);

bool TGvalid(struct TextGrid *tg, unsigned col, unsigned row);
char *TGcharptr(struct TextGrid *tg, unsigned col, unsigned row);
unsigned TGcol(struct TextGrid *tg, char *p);