| 12345678910111213141516171819202122232425262728 |
- namespace Day20;
- public record HiLo(long High, long Low)
- {
- public static HiLo Zero { get; } = new HiLo(0L, 0L);
-
- public HiLo Add(HiLo other)
- {
- return new HiLo(High + other.High, Low + other.Low);
- }
- public HiLo Add(Pulse p)
- {
- return p.Value
- ? this with { High = High + 1 }
- : this with { Low = Low + 1 };
- }
- public HiLo Multiply(long factor)
- {
- return new HiLo(factor * High, factor * Low);
- }
- public override string ToString()
- {
- return $"High: {High} / Low: {Low}";
- }
- }
|