aocc22

Advent of Code 2022
git clone git://www.tkruger.se/aocc22.git
Log | Files | Refs | README

common.h (590B)


      1 #ifndef COMMON_H_
      2 #define COMMON_H_
      3 
      4 #include <assert.h>
      5 #include <reading.h>
      6 #include <stdint.h>
      7 #include <stdio.h>
      8 
      9 typedef struct {
     10   size_t n;
     11   uint64_t *v;
     12 } bitvector;
     13 
     14 #define HEADBIT_U64 0x8000000000000000LL
     15 
     16 typedef struct {
     17   size_t n;
     18 
     19   size_t nalloc;
     20   uint8_t *d;
     21 } set;
     22 
     23 typedef struct {
     24   size_t h;
     25   size_t w;
     26   size_t lcm;
     27 
     28   bitvector **row_mask;
     29   bitvector **col_mask;
     30 } board;
     31 
     32 void play(char **lines, size_t nlines);
     33 board parse(char **lines, size_t nlines);
     34 int intersects(const board *b, const uint64_t x, const uint64_t y,
     35                const size_t r);
     36 
     37 #endif