aocc22

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

common.c (292B)


      1 #include "common.h"
      2 
      3 void parse(int64_t *d, char **lines, size_t nlines) {
      4   uint64_t tmp;
      5   int64_t tmpl;
      6   size_t i;
      7   for (i = 0; i < nlines; i++) {
      8     sread_next_u64(&tmp, lines[i]);
      9     tmpl = (int64_t)tmp;
     10     if (lines[i][0] == '-') {
     11       tmpl = -tmpl;
     12     }
     13     d[i] = tmpl;
     14   }
     15 }