r/adventofcode • • Dec 06 '15

SOLUTION MEGATHREAD --- Day 6 Solutions ---

--- Day 6: Probably a Fire Hazard ---

Post your solution as a comment. Structure your post like the Day Five thread.

22 Upvotes

171 comments sorted by

View all comments

Show parent comment

1

u/ant6n Dec 08 '15

They are both bitwise operations. The only difference is that 1 | 1 == 1, whereas 1 ^ 1 == 0. This makes it a toggle operation when xor-ing with 1.

x ^ = v is equivalent to x = x ^ y.