Compare commits
2 Commits
1f835c10c5
...
b64bc6c1d5
| Author | SHA1 | Date | |
|---|---|---|---|
| b64bc6c1d5 | |||
| 6aa605a0de |
11
2021/day24/EXAMPLE.txt
Normal file
11
2021/day24/EXAMPLE.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
inp w
|
||||
add z w
|
||||
mod z 2
|
||||
div w 2
|
||||
add y w
|
||||
mod y 2
|
||||
div w 2
|
||||
add x w
|
||||
mod x 2
|
||||
div w 2
|
||||
mod w 2
|
||||
2
2021/day24/EXAMPLE1.txt
Normal file
2
2021/day24/EXAMPLE1.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
inp x
|
||||
mul x -1
|
||||
4
2021/day24/EXAMPLE2.txt
Normal file
4
2021/day24/EXAMPLE2.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
inp z
|
||||
inp x
|
||||
mul z 3
|
||||
eql z x
|
||||
252
2021/day24/INPUT.txt
Normal file
252
2021/day24/INPUT.txt
Normal file
@@ -0,0 +1,252 @@
|
||||
inp w
|
||||
mul x 0
|
||||
add x z
|
||||
mod x 26
|
||||
div z 1
|
||||
add x 13
|
||||
eql x w
|
||||
eql x 0
|
||||
mul y 0
|
||||
add y 25
|
||||
mul y x
|
||||
add y 1
|
||||
mul z y
|
||||
mul y 0
|
||||
add y w
|
||||
add y 10
|
||||
mul y x
|
||||
add z y
|
||||
inp w
|
||||
mul x 0
|
||||
add x z
|
||||
mod x 26
|
||||
div z 1
|
||||
add x 11
|
||||
eql x w
|
||||
eql x 0
|
||||
mul y 0
|
||||
add y 25
|
||||
mul y x
|
||||
add y 1
|
||||
mul z y
|
||||
mul y 0
|
||||
add y w
|
||||
add y 16
|
||||
mul y x
|
||||
add z y
|
||||
inp w
|
||||
mul x 0
|
||||
add x z
|
||||
mod x 26
|
||||
div z 1
|
||||
add x 11
|
||||
eql x w
|
||||
eql x 0
|
||||
mul y 0
|
||||
add y 25
|
||||
mul y x
|
||||
add y 1
|
||||
mul z y
|
||||
mul y 0
|
||||
add y w
|
||||
add y 0
|
||||
mul y x
|
||||
add z y
|
||||
inp w
|
||||
mul x 0
|
||||
add x z
|
||||
mod x 26
|
||||
div z 1
|
||||
add x 10
|
||||
eql x w
|
||||
eql x 0
|
||||
mul y 0
|
||||
add y 25
|
||||
mul y x
|
||||
add y 1
|
||||
mul z y
|
||||
mul y 0
|
||||
add y w
|
||||
add y 13
|
||||
mul y x
|
||||
add z y
|
||||
inp w
|
||||
mul x 0
|
||||
add x z
|
||||
mod x 26
|
||||
div z 26
|
||||
add x -14
|
||||
eql x w
|
||||
eql x 0
|
||||
mul y 0
|
||||
add y 25
|
||||
mul y x
|
||||
add y 1
|
||||
mul z y
|
||||
mul y 0
|
||||
add y w
|
||||
add y 7
|
||||
mul y x
|
||||
add z y
|
||||
inp w
|
||||
mul x 0
|
||||
add x z
|
||||
mod x 26
|
||||
div z 26
|
||||
add x -4
|
||||
eql x w
|
||||
eql x 0
|
||||
mul y 0
|
||||
add y 25
|
||||
mul y x
|
||||
add y 1
|
||||
mul z y
|
||||
mul y 0
|
||||
add y w
|
||||
add y 11
|
||||
mul y x
|
||||
add z y
|
||||
inp w
|
||||
mul x 0
|
||||
add x z
|
||||
mod x 26
|
||||
div z 1
|
||||
add x 11
|
||||
eql x w
|
||||
eql x 0
|
||||
mul y 0
|
||||
add y 25
|
||||
mul y x
|
||||
add y 1
|
||||
mul z y
|
||||
mul y 0
|
||||
add y w
|
||||
add y 11
|
||||
mul y x
|
||||
add z y
|
||||
inp w
|
||||
mul x 0
|
||||
add x z
|
||||
mod x 26
|
||||
div z 26
|
||||
add x -3
|
||||
eql x w
|
||||
eql x 0
|
||||
mul y 0
|
||||
add y 25
|
||||
mul y x
|
||||
add y 1
|
||||
mul z y
|
||||
mul y 0
|
||||
add y w
|
||||
add y 10
|
||||
mul y x
|
||||
add z y
|
||||
inp w
|
||||
mul x 0
|
||||
add x z
|
||||
mod x 26
|
||||
div z 1
|
||||
add x 12
|
||||
eql x w
|
||||
eql x 0
|
||||
mul y 0
|
||||
add y 25
|
||||
mul y x
|
||||
add y 1
|
||||
mul z y
|
||||
mul y 0
|
||||
add y w
|
||||
add y 16
|
||||
mul y x
|
||||
add z y
|
||||
inp w
|
||||
mul x 0
|
||||
add x z
|
||||
mod x 26
|
||||
div z 26
|
||||
add x -12
|
||||
eql x w
|
||||
eql x 0
|
||||
mul y 0
|
||||
add y 25
|
||||
mul y x
|
||||
add y 1
|
||||
mul z y
|
||||
mul y 0
|
||||
add y w
|
||||
add y 8
|
||||
mul y x
|
||||
add z y
|
||||
inp w
|
||||
mul x 0
|
||||
add x z
|
||||
mod x 26
|
||||
div z 1
|
||||
add x 13
|
||||
eql x w
|
||||
eql x 0
|
||||
mul y 0
|
||||
add y 25
|
||||
mul y x
|
||||
add y 1
|
||||
mul z y
|
||||
mul y 0
|
||||
add y w
|
||||
add y 15
|
||||
mul y x
|
||||
add z y
|
||||
inp w
|
||||
mul x 0
|
||||
add x z
|
||||
mod x 26
|
||||
div z 26
|
||||
add x -12
|
||||
eql x w
|
||||
eql x 0
|
||||
mul y 0
|
||||
add y 25
|
||||
mul y x
|
||||
add y 1
|
||||
mul z y
|
||||
mul y 0
|
||||
add y w
|
||||
add y 2
|
||||
mul y x
|
||||
add z y
|
||||
inp w
|
||||
mul x 0
|
||||
add x z
|
||||
mod x 26
|
||||
div z 26
|
||||
add x -15
|
||||
eql x w
|
||||
eql x 0
|
||||
mul y 0
|
||||
add y 25
|
||||
mul y x
|
||||
add y 1
|
||||
mul z y
|
||||
mul y 0
|
||||
add y w
|
||||
add y 5
|
||||
mul y x
|
||||
add z y
|
||||
inp w
|
||||
mul x 0
|
||||
add x z
|
||||
mod x 26
|
||||
div z 26
|
||||
add x -12
|
||||
eql x w
|
||||
eql x 0
|
||||
mul y 0
|
||||
add y 25
|
||||
mul y x
|
||||
add y 1
|
||||
mul z y
|
||||
mul y 0
|
||||
add y w
|
||||
add y 10
|
||||
mul y x
|
||||
add z y
|
||||
77
2021/day24/Makefile
Normal file
77
2021/day24/Makefile
Normal file
@@ -0,0 +1,77 @@
|
||||
# AOC daily Makefile - GNU make only.
|
||||
#
|
||||
# Copyright (C) 2021 Bruno Raoult ("br")
|
||||
# Licensed under the GNU General Public License v3.0 or later.
|
||||
# Some rights reserved. See COPYING.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with this
|
||||
# program. If not, see <https://www.gnu.org/licenses/gpl-3.0-standalone.html>.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later <https://spdx.org/licenses/GPL-3.0-or-later.html>
|
||||
#
|
||||
|
||||
INPUT := INPUT.txt
|
||||
SHELL := /bin/bash
|
||||
|
||||
CC := gcc
|
||||
|
||||
LIB := aoc_$(shell uname -m)
|
||||
INCDIR := ../include
|
||||
LIBDIR := ../lib
|
||||
LDFLAGS := -L$(LIBDIR)
|
||||
#LDLIB := -l$(LIB) -lm
|
||||
LDLIB := -l$(LIB)
|
||||
|
||||
export LD_LIBRARY_PATH = $(LIBDIR)
|
||||
|
||||
CFLAGS += -std=gnu99
|
||||
CFLAGS += -O2
|
||||
CFLAGS += -g
|
||||
# for gprof
|
||||
#CFLAGS += -pg
|
||||
CFLAGS += -Wall
|
||||
CFLAGS += -Wextra
|
||||
CFLAGS += -march=native
|
||||
# Next one may be useful for valgrind (some invalid instructions)
|
||||
# CFLAGS += -mno-tbm
|
||||
CFLAGS += -Wmissing-declarations
|
||||
CFLAGS += -Wno-unused-result
|
||||
|
||||
CFLAGS += -DDEBUG_DEBUG # activate general debug (debug.c)
|
||||
CFLAGS += -DDEBUG_POOL # memory pools management
|
||||
|
||||
TIME := \time -f "\ttime: %E real, %U user, %S sys\n\tcontext-switch:\t%c+%w, page-faults: %F+%R\n"
|
||||
export PATH := .:$(PATH)
|
||||
|
||||
.PHONY: clean all compile assembly memcheck memcheck1 memcheck2 ex1 ex2
|
||||
|
||||
all: ex1 ex2
|
||||
|
||||
memcheck: memcheck1 memcheck2
|
||||
|
||||
memcheck1:
|
||||
@valgrind -q -s --track-origins=yes aoc-c -p 1 < $(INPUT)
|
||||
|
||||
memcheck2:
|
||||
@valgrind -q -s --track-origins=yes aoc-c -p 2 < $(INPUT)
|
||||
|
||||
compile: aoc-c
|
||||
|
||||
assembly: aoc-c.s
|
||||
|
||||
ex1: aoc-c
|
||||
@$(TIME) aoc-c -p 1 < $(INPUT)
|
||||
|
||||
ex2: aoc-c
|
||||
@$(TIME) aoc-c -p 2 < $(INPUT)
|
||||
|
||||
clean:
|
||||
@rm -f aoc-c core* vgcore* gmon.out aoc-c.s
|
||||
|
||||
.c:
|
||||
@echo compiling $<
|
||||
@$(CC) $(CFLAGS) $(LDFLAGS) -I $(INCDIR) $< $(LDLIB) -o $@
|
||||
|
||||
.c.s:
|
||||
@echo generating $@
|
||||
@$(CC) -S -fverbose-asm $(CFLAGS) -I $(INCDIR) $< -o $@
|
||||
62
2021/day24/README.txt
Normal file
62
2021/day24/README.txt
Normal file
@@ -0,0 +1,62 @@
|
||||
--- Day 24: Arithmetic Logic Unit ---
|
||||
|
||||
Magic smoke starts leaking from the submarine's arithmetic logic unit (ALU). Without the ability to perform basic arithmetic and logic functions, the submarine can't produce cool patterns with its Christmas lights!
|
||||
|
||||
It also can't navigate. Or run the oxygen system.
|
||||
|
||||
Don't worry, though - you probably have enough oxygen left to give you enough time to build a new ALU.
|
||||
|
||||
The ALU is a four-dimensional processing unit: it has integer variables w, x, y, and z. These variables all start with the value 0. The ALU also supports six instructions:
|
||||
|
||||
inp a - Read an input value and write it to variable a.
|
||||
add a b - Add the value of a to the value of b, then store the result in variable a.
|
||||
mul a b - Multiply the value of a by the value of b, then store the result in variable a.
|
||||
div a b - Divide the value of a by the value of b, truncate the result to an integer, then store the result in variable a. (Here, "truncate" means to round the value toward zero.)
|
||||
mod a b - Divide the value of a by the value of b, then store the remainder in variable a. (This is also called the modulo operation.)
|
||||
eql a b - If the value of a and b are equal, then store the value 1 in variable a. Otherwise, store the value 0 in variable a.
|
||||
|
||||
In all of these instructions, a and b are placeholders; a will always be the variable where the result of the operation is stored (one of w, x, y, or z), while b can be either a variable or a number. Numbers can be positive or negative, but will always be integers.
|
||||
|
||||
The ALU has no jump instructions; in an ALU program, every instruction is run exactly once in order from top to bottom. The program halts after the last instruction has finished executing.
|
||||
|
||||
(Program authors should be especially cautious; attempting to execute div with b=0 or attempting to execute mod with a<0 or b<=0 will cause the program to crash and might even damage the ALU. These operations are never intended in any serious ALU program.)
|
||||
|
||||
For example, here is an ALU program which takes an input number, negates it, and stores it in x:
|
||||
|
||||
inp x
|
||||
mul x -1
|
||||
|
||||
Here is an ALU program which takes two input numbers, then sets z to 1 if the second input number is three times larger than the first input number, or sets z to 0 otherwise:
|
||||
|
||||
inp z
|
||||
inp x
|
||||
mul z 3
|
||||
eql z x
|
||||
|
||||
Here is an ALU program which takes a non-negative integer as input, converts it into binary, and stores the lowest (1's) bit in z, the second-lowest (2's) bit in y, the third-lowest (4's) bit in x, and the fourth-lowest (8's) bit in w:
|
||||
|
||||
inp w
|
||||
add z w
|
||||
mod z 2
|
||||
div w 2
|
||||
add y w
|
||||
mod y 2
|
||||
div w 2
|
||||
add x w
|
||||
mod x 2
|
||||
div w 2
|
||||
mod w 2
|
||||
|
||||
Once you have built a replacement ALU, you can install it in the submarine, which will immediately resume what it was doing when the ALU failed: validating the submarine's model number. To do this, the ALU will run the MOdel Number Automatic Detector program (MONAD, your puzzle input).
|
||||
|
||||
Submarine model numbers are always fourteen-digit numbers consisting only of digits 1 through 9. The digit 0 cannot appear in a model number.
|
||||
|
||||
When MONAD checks a hypothetical fourteen-digit model number, it uses fourteen separate inp instructions, each expecting a single digit of the model number in order of most to least significant. (So, to check the model number 13579246899999, you would give 1 to the first inp instruction, 3 to the second inp instruction, 5 to the third inp instruction, and so on.) This means that when operating MONAD, each input instruction should only ever be given an integer value of at least 1 and at most 9.
|
||||
|
||||
Then, after MONAD has finished running all of its instructions, it will indicate that the model number was valid by leaving a 0 in variable z. However, if the model number was invalid, it will leave some other non-zero value in z.
|
||||
|
||||
MONAD imposes additional, mysterious restrictions on model numbers, and legend says the last copy of the MONAD documentation was eaten by a tanuki. You'll need to figure out what MONAD does some other way.
|
||||
|
||||
To enable as many submarine features as possible, find the largest valid fourteen-digit model number that contains no 0 digits. What is the largest model number accepted by MONAD?
|
||||
|
||||
To begin, get your puzzle input.
|
||||
7
2021/day25/EXAMPLE.txt
Normal file
7
2021/day25/EXAMPLE.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
...>...
|
||||
.......
|
||||
......>
|
||||
v.....>
|
||||
......>
|
||||
.......
|
||||
..vvv..
|
||||
9
2021/day25/EXAMPLE2.txt
Normal file
9
2021/day25/EXAMPLE2.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
v...>>.vv>
|
||||
.vv>>.vv..
|
||||
>>.>v>...v
|
||||
>>v>>.>.v.
|
||||
v>v.vv.v..
|
||||
>.>>..v...
|
||||
.vv..>.>v.
|
||||
v.v..>>v.v
|
||||
....v..v.>
|
||||
137
2021/day25/INPUT.txt
Normal file
137
2021/day25/INPUT.txt
Normal file
@@ -0,0 +1,137 @@
|
||||
>...>.v>vv>>..>>v...v..>>v.>..>.>>..>>>...>.>>>.>v.>..v>.v>.>v.v.......>..vv.......>v..>.>>...>>>vv....>v.>>.v>vvv..>>.v..v>.v..vv.v..vvvv.
|
||||
.>....>>......>..v..v...v.v.vvv>>>.v.vv>>v>>.>>>..vv...vv..vvv.v..>...>vv.>v.v>.v>>....vv.v...>v>>>vv.v......>v>..>v.v>....v.v.v>>v...v>..v
|
||||
vv>.>>>>.v..vv..v>v....>..vv.>...>>v.v.v>>v>.>>.v.v.>v.v.vv>v>>v.....v>v....vv.v>>v.v>>....v.>.....>v...>v.v.>.v..>.v.v.>v..vv.v..v>>v.v>..
|
||||
.v>>.>>v.....>>v>>>..>..>.v...>...>v.v..v>>v.>..v.v.>>v.>.>.v.>..>>.>.......vv>>.>v>>v..v..v.>v.vvvv.>.....v>>.>>.v..>>vv>vvv.>.v>v...vv.v.
|
||||
..>v>.vvv.>.v..v>>..>.v>vv.....>.v..v>v......v>..>v.>....>.>.vv.v...>.>..v.........vv>v...vv>v>v..v.>vvv..vv.>.>.>vvvv.vv..v.....>.>>>...>v
|
||||
v..>..v>>..>..>.v.>.>......vv.>..>>>v.>.>....vv>vv>...v>v>.>>>>v..>v..>v>>..>.>.>>>...vv>..>..v.>.>>.>>.>>...>>....v.v...>.v..v........>.vv
|
||||
..>..vv.v..v...>>>vvvvvv.v..vv..>v>>>>v.....v..v....>v.v..v.>...v.v.>..v..>.vvv..>..vv..v.v..v.>>...vv.v....v>...vv...>v.>v..>v..>.v......>
|
||||
..>>v....>.v..vvv>...>>v.vv......>v.v.vv.v>..>v>.>......v.v>.>>v.vv..v.>....vvv>.v.>v>v.vv.>v.>vvv.v>.......>.v>....>..>v.vvv...v.v>>v...>v
|
||||
..v>..>v.>v.>>....vvv.>>.>..v>>v>>v>.....v....v.>v..>...v>.....>.vv.>.....>.>.vv..>>v>.>.>>v.vvv....>v....>v.vvvv>.>>.v.v.v...>.>.vv..>.>..
|
||||
...>>.v..v>..>vvv..>v>..v.v......v.v.v>v>.v.>vv.v>.>v.>v...v>>>>>.>>v...>..>>v...v..>v>.v..vv>...v>v..>>v>>.v...v.>>.>...v.vv..>>>.>.v>v.v.
|
||||
vv...>>v.>>..v>v..>...>v...v>>vvvv..>v.v.v.>v...v>v.>v....v.v>v>v>vv.....v>..vv.v>.v...vv>.v>v..>>.vv>>.>.v.>.>vv.v..v>>....>>v.>...vv.v..>
|
||||
vv.>.>......>v.v.vv...v>v..v.>v.vvvv.>..vv>v.v.v..>>v>>>v....>.>.v.v>>...v.>v..>..>.>>v>>..>.vv.vv.>...v>>..v>..v...v.>.>.>....v>>..>vvv..>
|
||||
...>>.v>..>..v..v>>..v>>....>>....>..>>..>....>v.>v>vv...v.>...>vvv..v>v..>>...v.......v..>.vv>v>vv....>..v>..v>.>...v.vv>.v.vv..>....>.v..
|
||||
.v.v.>..>vvvvv..v>>..v.vv...>v....>.v.>.v..>...>..>>...v.>>>v.>>v.v....vv>.v>.>.vv.v....v>vvv.v>>...>v>.v.>vvvv.v.vv..>.>>.vvvvvv..vv>.v>>>
|
||||
v.v>.vv.>..v>vv>v>vv.>v.....v..>.......vv.....v>.v..v>.v....>....>>>..>...v>..>>..vv.v>.>....>.v.>...>..vvv>.>.v.v.>vv...>>>>.vvv.v.v...>>.
|
||||
.vvv...>....v.>.>v..>.vv.v.vv>v...v...........>.v>>.........>v....v..>v.>>..>.v>>.v>v....>>>v.v...v>>v..v.v>>>v....>.>.v....v>>.v..v..vv..>
|
||||
.v>>..>.....>.v.>>.v>......>v.>v......v..v>..v...>.....v>v..........>v.v.>.>>>.vvv>.>>.v.>v.v.>>.vvv..v......v>.v.>.v.>>>v.>v....>v>.v>..>.
|
||||
>>.>>>v.>v..v.>>>.v.v..>>v>...v.>vv>v..>v.>.vv.vv......>.>.>..>...>...>>.>v>...v...>.>vv...>....>.v.>....>.>.>..v.v..v..vvvv.>v.>......v>>.
|
||||
vv....>.>>.>>vv......v>>..v>>vv.v>v.>.>....v..vv..>..v>.v..v>vvv>.>>v....v..v.v>v.v.v>.v>v.v>....v.....vv...>vv.vvv.v..vv...v.>v.>v..v...>>
|
||||
...>.>...v....>...>>.>....v>v....>vv..v>...v>.....v>.v>..>>>>.>.v.>...vv..>>>v.>v.>>..>.v...>.>>.v>.v.........v..v.v>v.v.>.v>...>vv..>v>.v>
|
||||
>..vv..v.....>v.v.....vv.....>..>.>..>.v...>..>....>.>>vv......v..v>..v>vvv..>.>..vv..>>v>vv.>...>>..v.>.v.vv>>.>.v>>v..vv.>>....>...v...>>
|
||||
....>v>>v.>...>vv..v>>.>v.vv...v.>v.>.>>...>>v.v>.vv>v..vvv.v>..vv.v.v>..v>.>>v...>......>vv...vvv.v>v.>....vvv.vv.vv.>..>>v.>>>>.>.>v>.v..
|
||||
...v...>>.>.>.....v.v.>.....v..>.v>>.>..>vvvv..>..>v>.>.v..>>.v......>..vvv.v.v...v...>.>.v.....>v>...>.>....>.v.v>>.vv.....v..>>>vvv.>>..v
|
||||
..v.>v>.v.v.>>v>v>v...>..>..v.v>.>..v..>..>>..>>v.>.>...vvv..>v..v..>>v>...>v..v>......>.>vv.>.....>..>>>>>>v.v>..v..>v..>>>..>vvv>.v..v.>.
|
||||
v.>.>.v.>v...>.v.......>>....>...v.v>..>v>.v..v>..vv..v>...v.>..>>...v>..>.>.>v..>v>vv.v...v...>..v..>vv...>v>....>>v>.>.......v>>.....>v>v
|
||||
>.>>..v...>v...vvv.>vv......>>.v>.v...>>.v........>.>.v......vv.>>v>.>v.vvv>.v>.v..>.....v.v>v.v...v>>....>>..v....vv>>>v.>.v..v.>.v.v..vvv
|
||||
>.>.>....v...>>>...>v..>.v...>.vvv..v.....>>...>.>.v>..v..vv>>v>>.v>...v..>v>.vv.v.>.>..>.>v>>....>.>vv>..>>.>v...vv......vv>>>>>.>..>.>.v>
|
||||
>...>>....>...vv.v.>.v>..>.vv.vv....v.v.>.v>>....>>vvv>...>>>.v.>>..v.vv..>v>v>.v>>..........vvvv...>>vv..vv..>>v...vv>>...v>...v>.v...>>.v
|
||||
.v.>..v...vv..v>...v....>vv>v..>v..>..v>>v....>.v>.v.>.vv...v..v>>>>.v>>.vvv...>.v.>.>>>....>....v.v..>>>.v.>..v.>.....v..>>>>.v>..vv.v>>>>
|
||||
vv.v...v...v>..v>v>>..v.vv>>>>vvv.>v>vv...v>v......v...v>.......v.v..>.>....>>..>v>.v>>v.v.>.>v>>>.vv.v>>>..vv.>v.v>...>.v..v.vv.....>>>.>.
|
||||
.>.>v>..>.v.>v.vv.vv..v..>v..v>.>vv.>>.>..v...>>>.>.>.>>..>..>v>.v...vv.>.v.v.v.>>.>>>v>..>v..>>....>v.>>.....v.>.>>.............>...>.>>v.
|
||||
>..v..vvv>v>..>vv>...>.v.v.>v.>..>.>..>..>v.v.vvvv.v.....vv.v..v...vv.vv..>.v.v>>...v>>....v..>.v.v..v>..>>vv....>>>>..>..>>>>v>v...>...vv.
|
||||
..>.v....>v.v.v.>.>...>....>.>.>v.>>>.v>.vv.v>..vv>.v.>..>.vv>v..vv>>...>v>v..>vvvvv.vv....>>..vv>v>>v>....v>>...>v>vv>..vv>>>vvv..v.v>.>>v
|
||||
.v.v..v>....>>vv.vv.>.>..>v>..>.v.vv.>>v>.v.v.v...>.>>v.....>.>..>>v>.>..v.vv.>>>.vv>...v..>..v>vvvv>.....vv.v.>>>>..>>vv.>vv>.>>v>..>...>v
|
||||
.>v>.>>.>>>..v>v>.>>.v..>..>vv.v.>.vv.v.v>.>.vv.>..>>...>vv.>>..v..>..v.v.>>.v..v.vvvv>v>.v.>v..>v..>v.....>.v..v.>v....>.v>>>v.v>.>..>.v.v
|
||||
>..>v.....vv.v>v>>.v.>.vvvv..>vv.v.v>.vv>...>......v..>>.>..>.v...>.v.vv.....vv..vv....v>v>>vv..v...v..>>.>v>.>v......vvv.vv.v...>>..>.>v.>
|
||||
.v.v...>>v>v>...>>..v..v...v.v.>>.v>.v>v>.>vv>v...v>>.v>v.>.....v.>.>....v..v>v.>v>...>..>>...vvv>.vvv.>>>vvvvv>..>.v....v.>>>.>.vvv..>v.>v
|
||||
..vv>v..v>.>>..vvv....v>>>v..v....>.>.>...v.v.v.>>..v....>v>..v>>..v..>....v...vvvv.>v..>...v>.......>..v.vvv..>..>v....v>v>vv>....v.>..v>v
|
||||
.>>...v>vv.>.>v>>v.>v...>>.>.>..>v>v>>..>>>.>>v...>vv.>vv>v...v>v>...>>..v>..>.v>.>.>vv>.vv...>v.......v>.>v>.>....vv>...v.v.v.v.v>.>.>..v>
|
||||
>vv.v.vv>...v.>>>>>v.>>..v>..v.vvv...v...>.v...>...>vv..>.v.v....>.>v>.v..>.v...v>.>>...v..v>>..vv...v.>..v...>...v.>v..>v>>v.v>v.v..>>..v>
|
||||
..v...vv..>v.vvv>.....v..v..>>..vv>....v...>..>.....v.vv>.v>>>...>v.vv.v..>>v>>v..>v.....>..>.>.>.....v.>..v.....>.v.>>>vv.>>.vv>>..>.vvv.v
|
||||
vv...>..vvvv>>v..>v>.v.>>..>>v..>>.>.v>.>...>>...>.vvv>..vvv..v>....>.v>.>...>.>>>...vv...>.v>>.>.vv...>>>>.....v>>>..v..v...v..v..v...>...
|
||||
v>..v...>v..v..>....v.>>...>vv..v>..vv.v..v.v.vvvv>.>...v>>.>>>v.vvv..v...vv..v.>v>.v>>v>..vvvvv.>v.>.>...>>.v>.>.v.vvv....>..>...v>>..>v>.
|
||||
.>>v>vv.v>....>.>.v...vv>v..v>.v.v...>.>>....>.v.>.>v>>>.>.............v.vv.v>.vv.vv>>...v>..>.v..>v....v>v..v...v....>.>.....vv>>.....vvv.
|
||||
..v>.>>.>v......>.v.v.>vv>....>>...vvv>...v>.>.v..>vv..>>v......>v.>>vv.v....>..>vv.>>.v..>..>...vv>vv>>.vv.>>>>>>.>.vv.>vvv...>v>.>>v>v.>.
|
||||
v>..v.v.v..vv.>>.v>.v....v..>.>..v.v>v..>vv.v>....vv..v...>.>v.vv>....>.v>...v>..v.>.....>v...>>.v>.>.vv.>>.....>v>.vv.v...v...>v>>>v.>v>..
|
||||
>v>..v...>v..v.v..>>.v>>....>v.>v.>v.v.v.v..>>>.vv>>>.>vv..v....v..>..>v..>v..>.....>>v.>...>vv..>..>..vvv..v>..>.v>>>v.v.v>>...v.>v...>...
|
||||
..v...>...v...v..>>..v...>v..>.vv..v>.....>.v..vv>.>>.>...>>.v.v>>..v>.>...v>...>>v.vv..>>vv>..>v>...>..>v.>vv...>.v..v..v>...vv..>..>>..>.
|
||||
>...v.>......vv.>>..v.>........>v...v.>>v>>v.vv.>...v>..vv>>..>v..v>v.v>.v..v>.v.....>vv.v>>>..>.vv>vvv..v.>v...v.v.>...>>v.v.>>v>..v.vv.vv
|
||||
.>..vv>.>.v..>.v.v>..>.v>>>..>v>.v>.v.>>>>....v..>>>v>v.v..v>..vv>vv..vv.>v.v.vvv>.......>>.>>.v.>vvv..>v>....vv.v..>>.....>vv.v..>.vv>v.>.
|
||||
>>.v>.>.>....>....>v..>vv..>>v..>>>....v.>vvvv>>.>v...>...v>v..>...v.>..>.vv.vv..v>.vv>>.....v>..>v....>.>..v.v..>..>v>...v..>.v.......v.vv
|
||||
v>>....v.>.vv.vvv>>.v.v>>..>.>.....v...>v.>>..v...>...>v..vvv>.>.>>>v.vv>..>>..v>v.>vv...>..>v.>.>.v.>.>vv..vvv>>.>..>...v>.v>...v>.v>.>..v
|
||||
..>vvv..v..v>>.vvv>.v....vv.v>>vvv>>v......vv.....v>>>..>.v..>.v>v>v>v>v>.>....v>.vvv...vv>.v.v.>>.vv>...v>....v...>....>>>.>vv.>....>.>>vv
|
||||
v>vv...>>..>v.>v..v..v>v...vv..v>>.>v>..>...>>>.v.>vv.vv.>.>...v...>.>.v>..v>v..>v>vvv>vvv..v>>v>vv.>v>.>v....>vv...>>.v.>v..>.>>v..>...>..
|
||||
.>.vv.....>>v.>..vv...vv.v.>.>......vv..v>.>...v..v..v>.>.vvv...vv.v.....>.vvv.v..v>...>>v>v..>>v>....>.>..v.>v.>vv.>>..v.v..v.v>.v..>>>...
|
||||
v.>...v..v..>.v>v.>v.>.>..v>...>...>>v.>.>.>>vv>>>>>v..>.......>>...>.......>vv>>>>>....>.......vv>.>...v>..>v..>vv>>...>...>.v>.>>vv.>>...
|
||||
v.v..v>vv.v.>..>.v..>>v>....>>.v.>v>>v.>..v>v.v>...>>v>>vvv.>...vvv....v>.>>vv.v.....>>..v>.>.>>v......v>>..v>....v..>vv>.>vv>.>..v.>>.v.vv
|
||||
>..v....v.>>v>>vv.>.>.vv.>>..>v..>.v..>......>>.......vvv>.>>>>>>v.>>>>v.>v.>vv...v>vv..v>>..>..>.>>..vv.>>v>...v...>.>..>.>v..>..v.vv>>..v
|
||||
vvv.v..>.>vvv.>>...>>.....v.v>v>.>>>...v>v>v.vv>>>>vv...v>.....>v>v..v>>v...>.v..>>v>.v...>..vv....v.v.v.v.v...>.>.>.vv.>v.>>>>v>v>.>...v..
|
||||
v.v..>....v...v>.vv.v>.>>.>v..v>......>..v.>>vv>>.v...>......>>.>vvv.>>>v>.v..v...v...vvvvv>v..v..v>..>...v.....v>.>v..>v..v.>>v.>>.>v...v.
|
||||
v>>..>vv>>>........v.>>>.>>>>>>..>..>...>>.vv>vv.>..>..v.vvvv...>.>.>.v....>.>>v>v.>>.vv>.>..v..>...v.v...v>.>.v.>v>.v..>....vv.>>.vv.>>>..
|
||||
.v>.>....vv..>....v>.>>...>v>.v>.v......vv.>...>.......>.>v>vv.....>..>v>v.>....v.>>v.>>v>v.....>...v...vv..v>v>v>v..>>.vv>....v.v>...>..>.
|
||||
.>..vvvv.>...v......>>.v..>....>v>.v>.>...>.v.v..v......>.v>vv>v..>>..v>.>.....>.v...>..v.v..vv.vv>v..>>..>>..>vv>>>...v.v.>>>..>>v.>v>>..>
|
||||
>...>v>v.>.....v..>....v.>..>.>vv>>....v>....>v.>...v.>v.v....>...>v>v.>.v.....v.>>.>>v.>v..>v.vv.>v...>.v>.v....>>>..v>.>v.>>>>vv...v.>.>>
|
||||
v.....v>v>v>>v.>>>.>.>...>v..v......v.v>..vv>>.>v>v..v.>v>.>.>vv..>...v..>...>v.>>.....>>...>.>v.>v.v...>.>v.v>.v>.>..>>>.....>>v.>..v....v
|
||||
v...v..v>>.v.....>v>..>v.v.v...v...vv.>.>..vv>.>>...v.v>vv.v.>>...vv.v...v.>....v.>...>>..vvvv..v>>>vv.>>....v.v...v.>>vvv>..>v.vv>.>>.>.v.
|
||||
.vvv.vv..>vvv>.>..>..>>>v.vv>..v>.v..>.v.>v>vv..v.>.vvv..v>.v...>.v>>.>>.vv...>>.vv...v..vv..>v>vv>v.v...>v>>vvv.v>.vvv>.>.>.v....>..>>v.v.
|
||||
>>v>......v>v>...v.>v>v>>.vv.>..vv..>>..>v.>...>....v>..v.>.....v.>>.v.>...>>.>>.v>..>v..v..>...>v.>v.v...v>v..>>..v.v.>v..v..>>...>.vv.v..
|
||||
v.>.v.>.vv.vvv.vv.>v>....v......vv..vvv>...>>.>....v>.>.v....v....>>.....>.vv>.vv>v.>v.....>..>>.>v.vv..>v.>..v>v.v.>vvv>vv>.......v.v.vv>.
|
||||
v....>.>..v.>.>v>.v>vv..>>.v..v..v..>>.v>>...>v>...>v..v....>....v..>>..>>.v...>>....v..v.>v..>v>....>.v>>.v>v..>v>...v..v.>....v.....>..v>
|
||||
..>>...>v....>v>v>>>....v>v.....>>.v....>>>v.>...>..>.>>v.v.>v>>..v.>>.>vvv>>>.vvv.>..v.....>.vv..v.......v..>...>...>....>vvv..>>v.>..vv>>
|
||||
.v..v>....vv.>>v...>v..v.>....v>v.>..>>vv.>..>..v>.>...>v>v>v.v>.>.v..>>v>..vv..vv..>.v..vv>>>......vv.>v>>...>v.v.>>.>..vv.vv.>.>>>v>vv...
|
||||
>v>vv.......>v>.v...>v.vvv>...v.>.>v.v..v.v>v>v.v..v.v.>.v>>.>>..>..>.>>.>v>v..>.>...>vvv.v>v>.....v.vv>>.>.vv...>.>...v...v.>vv.v..>.vvv..
|
||||
>>.>>>......vvv>v..vv.v..v>>..v....>>.v..>vvvv>v>>...v>>>..>>vv...>>vv.>.vv>>>..vv>.v>..v.>..v.vv...v.>.vv>>vv>>>..>.v....v>>vv.>>.vv...>..
|
||||
v....>>>..v..>v..>.v>v...v>v..vv......>vv.v.>....>..v.vv..>vv>v.v..vvv.v.>v.>.v...>....v..>.>v.v>>.>.>v>>..>.vvv>vv.v.v.>vvvv>..>.........v
|
||||
......v>..>...v..vvv.v>...v.v>>vvv.v.>....v.v.v.>...v..v>>>>..vv.>v.>..>.v>>..>>.>vv.v>..v.>v>>..>v..>vv..>.vvv>..vv.vv...>.>>.vv..>...v>v>
|
||||
..v>>.>v.>.>v>..vv..>>..>>.>..v>...v..>>>..v..>.v.>v>..>>...vv.>v.>v...v>v..v>..>>vvv......vv.>...v..v>>>vv.v...v.v.v.>>>..vv>v>v...v>.....
|
||||
..v>>>..v..v.>>.>>.v..v......>>.vv>.v.v>>.>...>.v>>.>>..v.v>.v.>>....v.>.....>.>>v.v.....v>vv.>.>>>..v..>v....v>.vv>...v.v>v..v...>...>.>v.
|
||||
.>.v.....>v.vv..>.>v>v.>>v.v.>>..vv>>v...vvv..vv.v.>v....vv>....vvv.v..>>.v..>>>....v..>..>>>>>>.>.>.>.v..>.>...>>>.v>vvvvv.>..v.>>..vv.>>.
|
||||
>.>...>v..>>..v..v.v..v>....>.v.v>..v...v..vv.>v>vv.>....>>v.v>vv...>..v>..v..v>.v>..........vv>v.v.>....>.>.vv>>....>.v..v.v.>v>>>>..v.v..
|
||||
v.v>.v>>.>>.v.>>....v...>...v...v.v..>..>...>vvv>......vv...>>..vv.v>>>>..vvv....v.>v...vv.v.>v>..v.........>v>>.>..>.v..v..v.v.v.>.v>...v>
|
||||
vv.>.v..v...v.v.>>>vv..>...>.vvv>v.v>>>>>>....>>>...>v>>..v.>.vv>>v..v.>vv>.vvvv...>vv..v...>.>...vv>..v>.v.>v>.v>.v....v.v.>v..>........>.
|
||||
v>v>>..>.v.v..>v....>.>>..v>...v....>v.>.>..v.vvv..>.>vvv.>v..vv>...v.>.>v.>.v>.>...v.v>.>>>>>.>.....v.>..>v>.v..>>.>.>>...vv..vvv....v>.>.
|
||||
>..v.v.v...vv>..>>vv>v....vv>vv.v>v>>v>>....>.>.v>.>...v.>...>v..>v>vv..vv....>..vv..v>..>vv.v>>..>....>v.>>.v...>.>..v>>vv...vvvv.....>v>.
|
||||
v.v........>......v.v..v...>>>.v>v.>....vv>v>.v.v>..>>.v.>..>..vvvv>>.v.>v..vvv.v..>.vvvvv.>>>...v>.>v...v>>..>v.>>.v>>..v>.vv.vv.v>.v>v.v.
|
||||
v....>.v..v...vv.>.....v..v...>.....v.v.>...v..v.v>>>...>.v..vv.v.>>>v...>v.v...v.>>v..>..>.>.>>>..>v.>vv>vvvvvvv..>>...>v.>.v.v>>vv.>.v>>>
|
||||
>>.vv...v....>.v.v...>>.>>v.>..>>v.>>.....>>>vv........>>..v...v>v...v.vv..v.v>vvv.>.>v.....v..>>..>vv.v>..vvv>.....vv>....v...>.vv.v.>.>v>
|
||||
v.>.>.v>>...v.>>.>vv....v..v..>.>.>>vvvv.>>>.vvv.v.....>>>.>..v..>.vvvv>.v...v.v>..v.vvv..vv.>..v.>vv.>.vvv...v.vv..>v>v>>v>>..>v>>.>>.>...
|
||||
...>.>>>...v.>>.......>.>..v.v..>vvv...vv..v...>v>>.....>.vv.>v>.v.>vv>v>.......v>vvv..v>.......>..>v..>.>>...v..>..>...>>v..>.v.>v.v.v>...
|
||||
v...>.v>v>..>v.v......>.v....>v.>vv........vv.>>v.>.>......v.>v.>>>v..>.>>>..vv.v...v>>.v>...v>v..vv.>.>>..>.v..v.v.v.>...>v>>..>>>>>..v...
|
||||
v>.....>.>>vv>>v....>v.v..>v..>v..>v.v>v.>v..v.>v...>...v>..v..>.......v..>>v.vv......>>v>>v.vvv>..>>>v..v.>v..v>vv..v.>v.v.vvv>..v..>.....
|
||||
..vv.>vv.>vv..>..>>v.v.>>v.v>.>v>..>vv.>....>vv.v.>.........v...v.>>v>v>>>>.>..v...vvvv.>.v.........v..vv..v.>>.>.>v.>.vv.>....>vvvv.v..>.>
|
||||
..>..v>....>.vv.v..>...v>.....>>...v.v......v>>.vvvv..>....>..>.v...vv...>>vv>vv>....>v.v.>v>....vv.......>.>v.v>>v.v..>>....v.v.>>>v>.v..>
|
||||
..v>>vv>v.v.vv>>v.>v.v.v..>.v.>v..>v....>v.....v>vv....vv.v.....>.......v.>vvv..v.v.>..>.vv.>>v>..v.>..v.>>>..vv......>.>..........>v.v..v>
|
||||
.>>vvv.......v>...>>.>v>....v>v....vvv.v>......v...v..>v>>>>>.>.>v.>>>.>>>.>>>.vv.vv.....>...v.v>>.v.v..>>...>.v>v>vv.>vv.v..v>vvv.>v.>....
|
||||
..v.vv.v..v>v>......v.>..v..v>v..v...>..v.>....v>...vv>..>..vv.>..v.......v.v.>.>.vv...vvv>v>..v.>v>...v>.>vv.>v.>.>vvv.>..v.v.>.>.>v..v>>v
|
||||
vv>...vv>.vv..>.vv.v>.>......>.>.>>>>>.>....v...>.v.>..>v>..>>.v>v.>..>.v.....v.v>....v.v>.v.v>v.v>>>..v...>v>.v....vv..>.>..v..v.>>v.v...v
|
||||
vvv>.vv..v.>vv>..v...>>..v.......vv...v..v>...>>.>>>v>.v....>>.v....>>.>>.>vvv..>>>v.v.v...>.......>v>.>vv.vvvv.v..v.v...>..v.>.v..>v>vv>v.
|
||||
>.....v>>v....vv..v>...v>...>.>.v>>........v.>.......v.vv.v.v..vv..>..>>v.>.>>.v.>..>>>v..v.v.v....v.v..>>vv.v...v.v....v.>>v..v....v.v....
|
||||
.v.>....v.>.>>>v...v>v.>>.>.>.>>.>>>.>.vv...>.>>.>>...v....vv..>...>..v.>...vv...>v.>v>.v..>.>..v>>>v.vv..v..vv>>..v..v.v>.>>....>vvv.v>v..
|
||||
.>.>vvv...v.v..>..v...>.....>>>v.v>.>>v.v.v>.>vv......>..vv.v>.>.vv>v......v>....vv>.vv>....v..>>..v.>v.>.v.>>>>v>......>..>..v>...>.>vv>>.
|
||||
>v>v...>...v.vv>>.>.>v.>>.v..v..v..v>...vv>.....v...>...v.......>.v.....>>>.v...>..>v>.>>...v.>>.>..vv>.>v>..>.>...v.......v..vv.vv>.v.v>.v
|
||||
v.vv..v.v..v>.vv....>.>....>...v>>.>.>>v.vv>.>>...>>.>..>>>vv>.>.vvv...v..v..v.......v........v>v..v>..v.>vv>.>>..>....>..v.v>.vvv>.>.v..>.
|
||||
>.....>>..v>..v..>>.>v..v.v...v..v>.v.v>.v.v...v.>..vv.vv.>>...v...vv.>>.>.v>..v.....v.....>v.....>v>>v.>vv>..vv.vv>v>..v>..>.>v>v..>.>....
|
||||
>..v>..>..>...>.vv...v>..vv..>>.>>.>.vv.v......>>.>...........v.v>..v..........v.>>.>>>.v.vvv>vv.>.vvv>...>...v..>v..>>.>...v.>>>.>>>v>v>.v
|
||||
vvv......v..>>vv>.v>.vv>.>v...vvv>.>v.v>v..>>...v>..>..v>>>>>>..>>..vvv>.>>....>.v>..>...v..>>..vv>.>.v.v.v>.>>>.vvv>.v.>v>v>v.v.v..vv>v>>.
|
||||
.v..v.>>v..>.>.v>..>.>.......>.>v...vv.>>>.vv..v..>v.>vv.v......>v.>>.>v>v.>.v>..............>>.>>>v>>>v>.>vv>>.v.......v.v...v>vvv.v>>v>..
|
||||
...v>v.vvv...>.>.>>v>>>..v..>.....>....v..vv>v>>v.v.>>.v>>v..>.......vv...>......v.>.v..v.>>.>v..>>..>v>v.vvv>vvv...>..>v.v..v...v...v>....
|
||||
v..>.v.>>v..>v....vv.>...>v>..vvv..vv>>.>>.>>v>>>..>>..vv.>v......v.v>v.>.v>v.>.v..>..v...v>>....>v....v.>v.v.>...v..v..>v.>.>.v>v..>vv.>.v
|
||||
.>....vv>..vv>.>..vv.>v..v.v>>.v..>.......>vvv..v>vv.v>.v.vv.>......v.>.vv..v>...vvv>..v.>....vvv..>..vv.>>..>>....>.....v>>>.>.v..v.v..>..
|
||||
vv..v>v>...>..vv.>.>.....v..v..>vv>>...vv>>..>v.>v.>vvv>vv>>.v.>.vvvv.>...v>>.>..v.v>>v.vv...>..>..vv>.v.vvv>v.>>..>>......vv>>vvv...>..v>.
|
||||
>>>>...v.v.>vvv..>.v..>>>.>>..v...v>>.>v>>v....v>>v..v.....v..vv.v>..v>v>.....v.>...>>>vv.v.v.v...vv.v.....vv....v>.v.>.vv.>.v...vvv..vv.>>
|
||||
v.vvv>...v>vv.....v.vv.>.>v....v.>vv.v>>.v>..vv...>.v....>...>..>.v.>.v.vv.>.>>.>>v.>.v..>v..vv...v.>..v.>>.v>..>...v>.>>.>...>>....v....>.
|
||||
>.>.vv>>>.......>v....>>>...v.vv>>..>.v.v..v>.v.v.....>..>v>>.>..>.vv...>..>.>>vv....>..v...v....v>>vv.>v....v.v>>....vv>.vv.>v>>.v.>.>.>v.
|
||||
..v.>vv..v>.v..>.v......v...>.......v>v...vv>.v>....v.>....>....>v..v.>>>v>.v>..>.>v..>vv>>.>.>>.>..>v..v>>>...>>.v...>.vv>>.v.v>..v>.>.>>.
|
||||
v>>>.>v.v.>>v>.vvv.>v....>..>.v>..v>..v.v.v..>>.>>..vv>>..>v..>.vv...v...>v...v.v>vv>>.....v>v...v.v.>.>>..>>..>v......>vv.>>>>vvv>..v>vv>.
|
||||
v.vv..>v.v...>.>.>v.>vvv..>v.>vv.>v..v>.....>.>>.>>..v..v..v...v..v...v>.>v..v.>.>>.vvv>v..>...vvv.v>.>>....>>>..>.v..v.v.>.v....v>.v>...v.
|
||||
..v.v........v...>>vv>>.vv>>>>v......v>>v..v.v.....>.v.>.v..v.....>v..>>..>>>....v..>.vvv>>.>>vv.v>.v..>v..>....v.vv....v>>>v...>.>>>.v...v
|
||||
..>v.....v>.....v.>vv...v.v...>vv..v.v...>>.v>.v...>..>v>>v>>v>>>.vv>>>vv...v>..>vv..v>v>.>.v>>vv>...v.v>>.>.>.v..>v.....>>>.v.>v....v>v>v.
|
||||
.....v..v...>>>vv.>>>>>>>v...>.v>>>>v.vv.>.....v.>.v>...>.>.vvvvvv...>>>.vv>..>>...v.v>..>v.v>>v.vv>...v>...v>...>...vv....>vv....>.v.v.v>v
|
||||
..>>v>v.>..vv>..>...vv.>...>vv>>.v.....>....>.>.v>.v..>v..v.......v.......>>v>.>>v>>...vv>>>>....>>v>>......v.>..v>.>..>v...>>.>>>>.v.>..v.
|
||||
v>..v.>vv.>>..vvv>vv>vv>>.v>>.>>.>.>>>.v......v..>.>>v>.....>v>>.>vvvv..v....v..>>vv..>...>>>...v>.v.>..v.....>>.v.v>.>...>.>.v.>.v>...>>vv
|
||||
.v...vv.v>..v>.v.v>...>v.v>>>>..>.vv.........>v....v.vv.v>>v...>vv>>v..vv.v>.>.>>.v>..vv.v.>......v.>.v..>>>>>..v.>vv..v>.>.v..>..>..v..>v.
|
||||
>..>v.>.>..v.>......v>..>.>..v>.vv.>.>>>.vv>>v..>..>.>.>.v>>v.>>...>..>>......>..>>v.v>..>..v.....>.>.>>v.>..>.v...>.>...v.>>>v...>.v>v....
|
||||
>.v>>.vv...v>vv.>>.>vvv>>>>..v.v>vv..v..>vv.........v>...v..vvv.>.vv>>v>>>...>>v>vv...>..v.>.v.>>.>..>..>>..>v....>..>vv.....>>...>..v.v.>.
|
||||
..v>v>..>.v.....>>.v..v.v.v.>>vv..>v.>>..>.v>.v.vvv.....vv>...>.v>v.>v.>.>v.>>.>vv>.>>v..vv>v.v>v..>vv...v>>.>>>...v...>.>.vv.>>v>..v>v..v.
|
||||
.v>..v>v>>>..v.>..v..>.>>..>.>.>>.....vvv..v...vv.v>>>.>>.vv.v.v.>vv..v.....>.v>......v.>..v..>>..>vv...v>.>..>.>.vv>...v.>v...>.>>>.>..>vv
|
||||
.>..>v.vv.>vv.>vv..>..v>>.v.>.>v>v>>v...vv.>.>>>..v>.>v.>vv>.>..vv>v>.>v.>>.>.v..v.>.v>.>.>.v.v........>vv.vv.>vv>.>.v..v>.....>v.>vv.>vv.>
|
||||
..>.>vv.vv..>>.>vv.v.>...>vv.v.......>....>vv>vvvv>..v...>v.....>v>.>>v.>..vv>>v..v....v>vvvvvv.>....>.>>v..>.v...v>.>....vv...>.vvv>>>>.v.
|
||||
vv.>.v.v..>.>.........>v.v.v..>v....>.v>..>.>v>v..v>v....vv.>.....v.v.v>>>.v..v>.v.v..v..>v>..>......>.vvv..>..v...v........v..>....>..v..>
|
||||
>vv..>>v..>>vv...>...>>..v.v>....>>v>v>>.v.vv>.v.>>..v>>>>v>>v>>v.v.>>..>>>>>.>...>.>.>v....>..>>.vv....>....>vv>vv>....>....>vv>>>.>>>....
|
||||
.>v>....>>>.v>>>v.>v.vv>v>...v>v>..v.v.>>......>.....>.v..>vv>.vv..>.>v>v>.v>.v..>v..vv.v.>......>>>...>..vv.v>vvv>v.....v>>vv>v>.>.>.>.>>>
|
||||
....>v>..v>>v.v.>v.vv.>v...vv.v..>>v>>.>v.v>.....>v>.v>..>v..>.>vv>v.v>v.v.>vvv..v>..v.v.vv>....vvv...vv.vv>>.>vvv..>v>v..v..v.v>>>..>.>...
|
||||
>v>v.v...v.vv...>>vv>.....v....>...v..>.>......>v>>.>..v..>.>..>>.>....v..>>v.>v..>.>.vv>v..v...v>.>v.>>..>vv.>...v..>.>v....>..v>v....v.v.
|
||||
.>>.....>.vvv.v>.>v>>.....vv>....>..vvv>v.v..>v>>....>vv...v.v.>.vv.>>>.v>.>v.>>v.vv>..>>v>.vvv.v.v.v>>..v....>>.vv>v.>.>v.....v.>.....>...
|
||||
v...v..>v.>.>.v..>...>v.>..v..vv.v..>.>.v...v...>v>.vv..>.>v.>>.>v>..v.v.v.>v...>.>v>..v>.....v..v>>..>..vv>..>...v>>>..>>...v.>.v.v..>.>>>
|
||||
.>>>.>v.>>.>..>>...>v..v..>.>..v>v.>.>vv.v.v....vv..>.v>v...v.....v>...>>v.>.>.vv..>vv..>v>..>vv.>v..>>.v.>v.>>.>.v>..>>v>v.v>v..vv.>vv.>.>
|
||||
77
2021/day25/Makefile
Normal file
77
2021/day25/Makefile
Normal file
@@ -0,0 +1,77 @@
|
||||
# AOC daily Makefile - GNU make only.
|
||||
#
|
||||
# Copyright (C) 2021 Bruno Raoult ("br")
|
||||
# Licensed under the GNU General Public License v3.0 or later.
|
||||
# Some rights reserved. See COPYING.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with this
|
||||
# program. If not, see <https://www.gnu.org/licenses/gpl-3.0-standalone.html>.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later <https://spdx.org/licenses/GPL-3.0-or-later.html>
|
||||
#
|
||||
|
||||
INPUT := INPUT.txt
|
||||
SHELL := /bin/bash
|
||||
|
||||
CC := gcc
|
||||
|
||||
LIB := aoc_$(shell uname -m)
|
||||
INCDIR := ../include
|
||||
LIBDIR := ../lib
|
||||
LDFLAGS := -L$(LIBDIR)
|
||||
#LDLIB := -l$(LIB) -lm
|
||||
LDLIB := -l$(LIB)
|
||||
|
||||
export LD_LIBRARY_PATH = $(LIBDIR)
|
||||
|
||||
CFLAGS += -std=gnu99
|
||||
CFLAGS += -O2
|
||||
CFLAGS += -g
|
||||
# for gprof
|
||||
#CFLAGS += -pg
|
||||
CFLAGS += -Wall
|
||||
CFLAGS += -Wextra
|
||||
CFLAGS += -march=native
|
||||
# Next one may be useful for valgrind (some invalid instructions)
|
||||
# CFLAGS += -mno-tbm
|
||||
CFLAGS += -Wmissing-declarations
|
||||
CFLAGS += -Wno-unused-result
|
||||
|
||||
CFLAGS += -DDEBUG_DEBUG # activate general debug (debug.c)
|
||||
CFLAGS += -DDEBUG_POOL # memory pools management
|
||||
|
||||
TIME := \time -f "\ttime: %E real, %U user, %S sys\n\tcontext-switch:\t%c+%w, page-faults: %F+%R\n"
|
||||
export PATH := .:$(PATH)
|
||||
|
||||
.PHONY: clean all compile assembly memcheck memcheck1 memcheck2 ex1 ex2
|
||||
|
||||
all: ex1 ex2
|
||||
|
||||
memcheck: memcheck1 memcheck2
|
||||
|
||||
memcheck1:
|
||||
@valgrind -q -s --track-origins=yes aoc-c -p 1 < $(INPUT)
|
||||
|
||||
memcheck2:
|
||||
@valgrind -q -s --track-origins=yes aoc-c -p 2 < $(INPUT)
|
||||
|
||||
compile: aoc-c
|
||||
|
||||
assembly: aoc-c.s
|
||||
|
||||
ex1: aoc-c
|
||||
@$(TIME) aoc-c -p 1 < $(INPUT)
|
||||
|
||||
ex2: aoc-c
|
||||
@$(TIME) aoc-c -p 2 < $(INPUT)
|
||||
|
||||
clean:
|
||||
@rm -f aoc-c core* vgcore* gmon.out aoc-c.s
|
||||
|
||||
.c:
|
||||
@echo compiling $<
|
||||
@$(CC) $(CFLAGS) $(LDFLAGS) -I $(INCDIR) $< $(LDLIB) -o $@
|
||||
|
||||
.c.s:
|
||||
@echo generating $@
|
||||
@$(CC) -S -fverbose-asm $(CFLAGS) -I $(INCDIR) $< -o $@
|
||||
285
2021/day25/README.txt
Normal file
285
2021/day25/README.txt
Normal file
@@ -0,0 +1,285 @@
|
||||
--- Day 25: Sea Cucumber ---
|
||||
|
||||
This is it: the bottom of the ocean trench, the last place the sleigh keys could be. Your submarine's experimental antenna still isn't boosted enough to detect the keys, but they must be here. All you need to do is reach the seafloor and find them.
|
||||
|
||||
At least, you'd touch down on the seafloor if you could; unfortunately, it's completely covered by two large herds of sea cucumbers, and there isn't an open space large enough for your submarine.
|
||||
|
||||
You suspect that the Elves must have done this before, because just then you discover the phone number of a deep-sea marine biologist on a handwritten note taped to the wall of the submarine's cockpit.
|
||||
|
||||
"Sea cucumbers? Yeah, they're probably hunting for food. But don't worry, they're predictable critters: they move in perfectly straight lines, only moving forward when there's space to do so. They're actually quite polite!"
|
||||
|
||||
You explain that you'd like to predict when you could land your submarine.
|
||||
|
||||
"Oh that's easy, they'll eventually pile up and leave enough space for-- wait, did you say submarine? And the only place with that many sea cucumbers would be at the very bottom of the Mariana--" You hang up the phone.
|
||||
|
||||
There are two herds of sea cucumbers sharing the same region; one always moves east (>), while the other always moves south (v). Each location can contain at most one sea cucumber; the remaining locations are empty (.). The submarine helpfully generates a map of the situation (your puzzle input). For example:
|
||||
|
||||
v...>>.vv>
|
||||
.vv>>.vv..
|
||||
>>.>v>...v
|
||||
>>v>>.>.v.
|
||||
v>v.vv.v..
|
||||
>.>>..v...
|
||||
.vv..>.>v.
|
||||
v.v..>>v.v
|
||||
....v..v.>
|
||||
|
||||
Every step, the sea cucumbers in the east-facing herd attempt to move forward one location, then the sea cucumbers in the south-facing herd attempt to move forward one location. When a herd moves forward, every sea cucumber in the herd first simultaneously considers whether there is a sea cucumber in the adjacent location it's facing (even another sea cucumber facing the same direction), and then every sea cucumber facing an empty location simultaneously moves into that location.
|
||||
|
||||
So, in a situation like this:
|
||||
|
||||
...>>>>>...
|
||||
|
||||
After one step, only the rightmost sea cucumber would have moved:
|
||||
|
||||
...>>>>.>..
|
||||
|
||||
After the next step, two sea cucumbers move:
|
||||
|
||||
...>>>.>.>.
|
||||
|
||||
During a single step, the east-facing herd moves first, then the south-facing herd moves. So, given this situation:
|
||||
|
||||
..........
|
||||
.>v....v..
|
||||
.......>..
|
||||
..........
|
||||
|
||||
After a single step, of the sea cucumbers on the left, only the south-facing sea cucumber has moved (as it wasn't out of the way in time for the east-facing cucumber on the left to move), but both sea cucumbers on the right have moved (as the east-facing sea cucumber moved out of the way of the south-facing sea cucumber):
|
||||
|
||||
..........
|
||||
.>........
|
||||
..v....v>.
|
||||
..........
|
||||
|
||||
Due to strong water currents in the area, sea cucumbers that move off the right edge of the map appear on the left edge, and sea cucumbers that move off the bottom edge of the map appear on the top edge. Sea cucumbers always check whether their destination location is empty before moving, even if that destination is on the opposite side of the map:
|
||||
|
||||
Initial state:
|
||||
...>...
|
||||
.......
|
||||
......>
|
||||
v.....>
|
||||
......>
|
||||
.......
|
||||
..vvv..
|
||||
|
||||
After 1 step:
|
||||
..vv>..
|
||||
.......
|
||||
>......
|
||||
v.....>
|
||||
>......
|
||||
.......
|
||||
....v..
|
||||
|
||||
After 2 steps:
|
||||
....v>.
|
||||
..vv...
|
||||
.>.....
|
||||
......>
|
||||
v>.....
|
||||
.......
|
||||
.......
|
||||
|
||||
After 3 steps:
|
||||
......>
|
||||
..v.v..
|
||||
..>v...
|
||||
>......
|
||||
..>....
|
||||
v......
|
||||
.......
|
||||
|
||||
After 4 steps:
|
||||
>......
|
||||
..v....
|
||||
..>.v..
|
||||
.>.v...
|
||||
...>...
|
||||
.......
|
||||
v......
|
||||
|
||||
To find a safe place to land your submarine, the sea cucumbers need to stop moving. Again consider the first example:
|
||||
|
||||
Initial state:
|
||||
v...>>.vv>
|
||||
.vv>>.vv..
|
||||
>>.>v>...v
|
||||
>>v>>.>.v.
|
||||
v>v.vv.v..
|
||||
>.>>..v...
|
||||
.vv..>.>v.
|
||||
v.v..>>v.v
|
||||
....v..v.>
|
||||
|
||||
After 1 step:
|
||||
....>.>v.>
|
||||
v.v>.>v.v.
|
||||
>v>>..>v..
|
||||
>>v>v>.>.v
|
||||
.>v.v...v.
|
||||
v>>.>vvv..
|
||||
..v...>>..
|
||||
vv...>>vv.
|
||||
>.v.v..v.v
|
||||
|
||||
After 2 steps:
|
||||
>.v.v>>..v
|
||||
v.v.>>vv..
|
||||
>v>.>.>.v.
|
||||
>>v>v.>v>.
|
||||
.>..v....v
|
||||
.>v>>.v.v.
|
||||
v....v>v>.
|
||||
.vv..>>v..
|
||||
v>.....vv.
|
||||
|
||||
After 3 steps:
|
||||
v>v.v>.>v.
|
||||
v...>>.v.v
|
||||
>vv>.>v>..
|
||||
>>v>v.>.v>
|
||||
..>....v..
|
||||
.>.>v>v..v
|
||||
..v..v>vv>
|
||||
v.v..>>v..
|
||||
.v>....v..
|
||||
|
||||
After 4 steps:
|
||||
v>..v.>>..
|
||||
v.v.>.>.v.
|
||||
>vv.>>.v>v
|
||||
>>.>..v>.>
|
||||
..v>v...v.
|
||||
..>>.>vv..
|
||||
>.v.vv>v.v
|
||||
.....>>vv.
|
||||
vvv>...v..
|
||||
|
||||
After 5 steps:
|
||||
vv>...>v>.
|
||||
v.v.v>.>v.
|
||||
>.v.>.>.>v
|
||||
>v>.>..v>>
|
||||
..v>v.v...
|
||||
..>.>>vvv.
|
||||
.>...v>v..
|
||||
..v.v>>v.v
|
||||
v.v.>...v.
|
||||
|
||||
...
|
||||
|
||||
After 10 steps:
|
||||
..>..>>vv.
|
||||
v.....>>.v
|
||||
..v.v>>>v>
|
||||
v>.>v.>>>.
|
||||
..v>v.vv.v
|
||||
.v.>>>.v..
|
||||
v.v..>v>..
|
||||
..v...>v.>
|
||||
.vv..v>vv.
|
||||
|
||||
...
|
||||
|
||||
After 20 steps:
|
||||
v>.....>>.
|
||||
>vv>.....v
|
||||
.>v>v.vv>>
|
||||
v>>>v.>v.>
|
||||
....vv>v..
|
||||
.v.>>>vvv.
|
||||
..v..>>vv.
|
||||
v.v...>>.v
|
||||
..v.....v>
|
||||
|
||||
...
|
||||
|
||||
After 30 steps:
|
||||
.vv.v..>>>
|
||||
v>...v...>
|
||||
>.v>.>vv.>
|
||||
>v>.>.>v.>
|
||||
.>..v.vv..
|
||||
..v>..>>v.
|
||||
....v>..>v
|
||||
v.v...>vv>
|
||||
v.v...>vvv
|
||||
|
||||
...
|
||||
|
||||
After 40 steps:
|
||||
>>v>v..v..
|
||||
..>>v..vv.
|
||||
..>>>v.>.v
|
||||
..>>>>vvv>
|
||||
v.....>...
|
||||
v.v...>v>>
|
||||
>vv.....v>
|
||||
.>v...v.>v
|
||||
vvv.v..v.>
|
||||
|
||||
...
|
||||
|
||||
After 50 steps:
|
||||
..>>v>vv.v
|
||||
..v.>>vv..
|
||||
v.>>v>>v..
|
||||
..>>>>>vv.
|
||||
vvv....>vv
|
||||
..v....>>>
|
||||
v>.......>
|
||||
.vv>....v>
|
||||
.>v.vv.v..
|
||||
|
||||
...
|
||||
|
||||
After 55 steps:
|
||||
..>>v>vv..
|
||||
..v.>>vv..
|
||||
..>>v>>vv.
|
||||
..>>>>>vv.
|
||||
v......>vv
|
||||
v>v....>>v
|
||||
vvv...>..>
|
||||
>vv.....>.
|
||||
.>v.vv.v..
|
||||
|
||||
After 56 steps:
|
||||
..>>v>vv..
|
||||
..v.>>vv..
|
||||
..>>v>>vv.
|
||||
..>>>>>vv.
|
||||
v......>vv
|
||||
v>v....>>v
|
||||
vvv....>.>
|
||||
>vv......>
|
||||
.>v.vv.v..
|
||||
|
||||
After 57 steps:
|
||||
..>>v>vv..
|
||||
..v.>>vv..
|
||||
..>>v>>vv.
|
||||
..>>>>>vv.
|
||||
v......>vv
|
||||
v>v....>>v
|
||||
vvv.....>>
|
||||
>vv......>
|
||||
.>v.vv.v..
|
||||
|
||||
After 58 steps:
|
||||
..>>v>vv..
|
||||
..v.>>vv..
|
||||
..>>v>>vv.
|
||||
..>>>>>vv.
|
||||
v......>vv
|
||||
v>v....>>v
|
||||
vvv.....>>
|
||||
>vv......>
|
||||
.>v.vv.v..
|
||||
|
||||
In this example, the sea cucumbers stop moving after 58 steps.
|
||||
|
||||
Find somewhere safe to land your submarine. What is the first step on which no sea cucumbers move?
|
||||
|
||||
To begin, get your puzzle input.
|
||||
@@ -29,6 +29,8 @@
|
||||
#error "Only 64 bits word size supported."
|
||||
#endif
|
||||
|
||||
/* fixed-size types
|
||||
*/
|
||||
typedef int64_t s64;
|
||||
typedef int32_t s32;
|
||||
typedef int16_t s16;
|
||||
@@ -38,9 +40,18 @@ typedef uint64_t u64;
|
||||
typedef uint32_t u32;
|
||||
typedef uint16_t u16;
|
||||
typedef uint8_t u8;
|
||||
|
||||
/* convenience types
|
||||
*/
|
||||
typedef unsigned long int ulong;
|
||||
typedef unsigned int uint;
|
||||
typedef unsigned short ushort;
|
||||
typedef unsigned char uchar;
|
||||
|
||||
/* char is a special case, as it can be signed or unsigned
|
||||
*/
|
||||
typedef signed char schar;
|
||||
|
||||
/* count trailing zeroes : 00101000 -> 3
|
||||
* ^^^
|
||||
*/
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#define _unused __attribute__((__unused__))
|
||||
#define _printf __attribute__ ((format (printf, 6, 7)))
|
||||
#ifdef DEBUG_DEBUG
|
||||
#define _printf __attribute__ ((format (printf, 6, 7)))
|
||||
void debug_init(u32 level);
|
||||
void debug_level_set(u32 level);
|
||||
void debug_devel_set(u32 level);
|
||||
|
||||
@@ -30,44 +30,44 @@
|
||||
/************ originally in <include/linux/compiler_types.h> */
|
||||
/*
|
||||
* __unqual_scalar_typeof(x) - Declare an unqualified scalar type, leaving
|
||||
* non-scalar types unchanged.
|
||||
* non-scalar types unchanged.
|
||||
*/
|
||||
/*
|
||||
* Prefer C11 _Generic for better compile-times and simpler code. Note: 'char'
|
||||
* is not type-compatible with 'signed char', and we define a separate case.
|
||||
*/
|
||||
#define __scalar_type_to_expr_cases(type) \
|
||||
unsigned type: (unsigned type)0, \
|
||||
signed type: (signed type)0
|
||||
#define __scalar_type_to_expr_cases(type) \
|
||||
unsigned type: (unsigned type)0, \
|
||||
signed type: (signed type)0
|
||||
|
||||
#define __unqual_scalar_typeof(x) typeof( \
|
||||
_Generic((x), \
|
||||
char: (char)0, \
|
||||
__scalar_type_to_expr_cases(char), \
|
||||
__scalar_type_to_expr_cases(short), \
|
||||
__scalar_type_to_expr_cases(int), \
|
||||
__scalar_type_to_expr_cases(long), \
|
||||
__scalar_type_to_expr_cases(long long), \
|
||||
default: (x)))
|
||||
#define __unqual_scalar_typeof(x) \
|
||||
typeof(_Generic((x), \
|
||||
char: (char)0, \
|
||||
__scalar_type_to_expr_cases(char), \
|
||||
__scalar_type_to_expr_cases(short), \
|
||||
__scalar_type_to_expr_cases(int), \
|
||||
__scalar_type_to_expr_cases(long), \
|
||||
__scalar_type_to_expr_cases(long long), \
|
||||
default: (x)))
|
||||
|
||||
/* Is this type a native word size -- useful for atomic operations */
|
||||
#define __native_word(t) \
|
||||
(sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
|
||||
sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
|
||||
(sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
|
||||
sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
|
||||
|
||||
#ifdef __OPTIMIZE__
|
||||
# define __compiletime_assert(condition, msg, prefix, suffix) \
|
||||
do { \
|
||||
extern void prefix ## suffix(void) __compiletime_error(msg); \
|
||||
if (!(condition)) \
|
||||
prefix ## suffix(); \
|
||||
} while (0)
|
||||
# define __compiletime_assert(condition, msg, prefix, suffix) \
|
||||
do { \
|
||||
extern void prefix ## suffix(void) __compiletime_error(msg); \
|
||||
if (!(condition)) \
|
||||
prefix ## suffix(); \
|
||||
} while (0)
|
||||
#else
|
||||
# define __compiletime_assert(condition, msg, prefix, suffix) do { } while (0)
|
||||
#endif
|
||||
|
||||
#define _compiletime_assert(condition, msg, prefix, suffix) \
|
||||
__compiletime_assert(condition, msg, prefix, suffix)
|
||||
__compiletime_assert(condition, msg, prefix, suffix)
|
||||
|
||||
/**
|
||||
* compiletime_assert - break build and emit msg if condition is false
|
||||
@@ -78,12 +78,12 @@
|
||||
* supplied condition is *false*, emitting the supplied error message if the
|
||||
* compiler has support to do so.
|
||||
*/
|
||||
#define compiletime_assert(condition, msg) \
|
||||
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
|
||||
#define compiletime_assert(condition, msg) \
|
||||
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
|
||||
|
||||
#define compiletime_assert_atomic_type(t) \
|
||||
compiletime_assert(__native_word(t), \
|
||||
"Need native word sized stores/loads for atomicity.")
|
||||
#define compiletime_assert_atomic_type(t) \
|
||||
compiletime_assert(__native_word(t), \
|
||||
"Need native word sized stores/loads for atomicity.")
|
||||
|
||||
/************ originally in <asm-generic/rwonce.h> */
|
||||
/*
|
||||
@@ -92,33 +92,33 @@
|
||||
* rely on the access being split into 2x32-bit accesses for a 32-bit quantity
|
||||
* (e.g. a virtual address) and a strong prevailing wind.
|
||||
*/
|
||||
#define compiletime_assert_rwonce_type(t) \
|
||||
compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
|
||||
"Unsupported access size for {READ,WRITE}_ONCE().")
|
||||
#define compiletime_assert_rwonce_type(t) \
|
||||
compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
|
||||
"Unsupported access size for {READ,WRITE}_ONCE().")
|
||||
|
||||
/*
|
||||
* Use __READ_ONCE() instead of READ_ONCE() if you do not require any
|
||||
* atomicity. Note that this may result in tears!
|
||||
*/
|
||||
#ifndef __READ_ONCE
|
||||
#define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
|
||||
#define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
|
||||
#endif
|
||||
|
||||
#define READ_ONCE(x) \
|
||||
({ \
|
||||
compiletime_assert_rwonce_type(x); \
|
||||
__READ_ONCE(x); \
|
||||
#define READ_ONCE(x) \
|
||||
({ \
|
||||
compiletime_assert_rwonce_type(x); \
|
||||
__READ_ONCE(x); \
|
||||
})
|
||||
|
||||
#define __WRITE_ONCE(x, val) \
|
||||
do { \
|
||||
*(volatile typeof(x) *)&(x) = (val); \
|
||||
#define __WRITE_ONCE(x, val) \
|
||||
do { \
|
||||
*(volatile typeof(x) *)&(x) = (val); \
|
||||
} while (0)
|
||||
|
||||
#define WRITE_ONCE(x, val) \
|
||||
do { \
|
||||
compiletime_assert_rwonce_type(x); \
|
||||
__WRITE_ONCE(x, val); \
|
||||
#define WRITE_ONCE(x, val) \
|
||||
do { \
|
||||
compiletime_assert_rwonce_type(x); \
|
||||
__WRITE_ONCE(x, val); \
|
||||
} while (0)
|
||||
|
||||
#endif /* __BR_RWONCE_H */
|
||||
|
||||
Reference in New Issue
Block a user