/// <summary> /// Reads the status of the specified pins. /// </summary> /// <param name="pins">The pins.</param> /// <returns> /// The pins status. /// </returns> public ProcessorPins Read(ProcessorPins pins) { return pins.Enumerate() .Select(p => Read(p) ? (ProcessorPins) ((uint) 1 << (int) p) : ProcessorPins.None) .Aggregate( ProcessorPins.None, (a, p) => a | p); }
/// <summary> /// Reads the status of the specified pins. /// </summary> /// <param name="pins">The pins.</param> /// <returns> /// The pins status. /// </returns> public ProcessorPins Read(ProcessorPins pins) { return(pins.Enumerate() .Select(p => this.Read(p) ? (ProcessorPins)(1U << (int)p) : ProcessorPins.None) .Aggregate( ProcessorPins.None, (a, p) => a | p)); }
public void enumerateTest() { var pins1 = new ProcessorPins(); pins1.Set(0, true); var pins = pins1.Enumerate(); Assert.AreEqual(1, pins.Count()); Assert.AreEqual(0, pins.ToArray()[0]); }