Skip to content

Commit

Permalink
Prefer typedef
Browse files Browse the repository at this point in the history
  • Loading branch information
lerno committed Mar 20, 2023
1 parent db1e8c4 commit 31d4f26
Show file tree
Hide file tree
Showing 15 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion day12.c3
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import std::io;
import std::math;
import std::collections::list;

define MapList = List<String>;
typedef MapList = List<String>;

struct Map
{
Expand Down
6 changes: 3 additions & 3 deletions day13.c3
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ struct PacketPair
Packet* p2;
}

define PacketList = List<Packet*>;
typedef PacketList = List<Packet*>;

define Packet = List<PacketElement*>;
typedef Packet = List<PacketElement*>;

define PacketPairs = List<PacketPair>;
typedef PacketPairs = List<PacketPair>;

struct PacketElement
{
Expand Down
2 changes: 1 addition & 1 deletion day14.c3
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import std::io;
import std::math;

const ENV_SIDE = 1000;
define Environment = int[ENV_SIDE][ENV_SIDE];
typedef Environment = int[ENV_SIDE][ENV_SIDE];

enum Result
{
Expand Down
2 changes: 1 addition & 1 deletion day15.c3
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import std::math;
import std::collections::list;
import std::collections::priorityqueue;

define CoordPairList = List<int[<2>][2]>;
typedef CoordPairList = List<int[<2>][2]>;

fn int[<2>]! parse_coord(String s)
{
Expand Down
4 changes: 2 additions & 2 deletions day16.c3
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import std::math;
import std::collections::map;
import std::collections::list;

define ValveMap = HashMap<String, int>;
define IntPairList = List<int[<2>]>;
typedef ValveMap = HashMap<String, int>;
typedef IntPairList = List<int[<2>]>;
ValveMap v;

struct Valve
Expand Down
4 changes: 2 additions & 2 deletions day17.c3
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import std::math;
import std::collections::map;
import std::collections::list;

define StateCacheMap = HashMap<StateCache, int>;
typedef StateCacheMap = HashMap<StateCache, int>;

struct StateCache
{
Expand Down Expand Up @@ -85,7 +85,7 @@ Shape[5] shapes = {
}
};

define GameRow = distinct char;
typedef GameRow = distinct char;
GameRow[1000] game;

macro bool GameRow.is_full(GameRow row)
Expand Down
2 changes: 1 addition & 1 deletion day19.c3
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import std::math;
import std::collections::map;
import std::collections::list;

define BlueprintList = List<Blueprint>;
typedef BlueprintList = List<Blueprint>;

const usz ORE = 0;
const usz CLAY = 1;
Expand Down
2 changes: 1 addition & 1 deletion day20.c3
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import std::math;
import std::collections::map;
import std::collections::list;

define LongList = List<long>;
typedef LongList = List<long>;

fn void load_crypto(LongList* list, LongList* pos, long key)
{
Expand Down
6 changes: 3 additions & 3 deletions day21.c3
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import std::math;
import std::collections::map;
import std::collections::list;

define MonkeyList = List<Monkey>;
define NameMap = HashMap<String, MonkeyId>;
typedef MonkeyList = List<Monkey>;
typedef NameMap = HashMap<String, MonkeyId>;

enum Action
{
Expand All @@ -16,7 +16,7 @@ enum Action
MINUS,
}

define MonkeyId = distinct int;
typedef MonkeyId = distinct int;

struct Monkey
{
Expand Down
2 changes: 1 addition & 1 deletion day23.c3
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import std::io;
import std::math;
import std::collections::list;

define CharsArray = List<String>;
typedef CharsArray = List<String>;

// Pick a padding that doesn't hit the asserts.
const int PADDING = 100;
Expand Down
2 changes: 1 addition & 1 deletion day24.c3
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import std::io;
import std::math;
import std::collections::list;

define CharsArray = List<String>;
typedef CharsArray = List<String>;

const int PADDING = 100;

Expand Down
2 changes: 1 addition & 1 deletion day3.c3
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module day3;
import std::io;
import std::collections::map;

define CharSet = HashMap<char, char>;
typedef CharSet = HashMap<char, char>;

fn int evaluate(char c)
{
Expand Down
2 changes: 1 addition & 1 deletion day5.c3
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module day5;
import std::io;
import std::collections::list;

define CharList = list::List<char>;
typedef CharList = list::List<char>;

const MAX_PILES = 20;

Expand Down
2 changes: 1 addition & 1 deletion day7.c3
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module day7;
import std::collections::list;
import std::io;

define DirList = List<Directory*>;
typedef DirList = List<Directory*>;

struct Directory
{
Expand Down
2 changes: 1 addition & 1 deletion day8.c3
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module day8;
import std::collections::list;
import std::io;

define Forest = distinct List<String>;
typedef Forest = distinct List<String>;
fn Forest* parse_forest()
{
File f = file::open("forest.txt", "rb")!!;
Expand Down

0 comments on commit 31d4f26

Please sign in to comment.