private byte[] GenerateLine(ushort address) { var lineValues = new byte[LINE_SIZE]; for (var i = 0; i < LINE_SIZE; i++) { lineValues[i] = this.Memory.Content[address + i]; } var lineData = new byte[WIDTH]; for (var i = 0; i < LINE_SIZE; i++) { var lineBit = 7; for (var bit = 0; bit < WIDTH; bit++) { if (Bit.IsSet(lineValues[i], bit)) { lineData[lineBit] = Bit.Set(lineData[lineBit], i, true); } lineBit -= 1; } } return(lineData); }
public void TestIsSetWithInt() { int x = A | D; Assert.IsTrue(Bit.IsSet(x, A), "Expected: true, because A is set in x"); Assert.IsFalse(Bit.IsSet(x, B), "Expected: false, because B is not set in x"); Assert.IsTrue(Bit.IsSet(x, D), "Expected: true, because D is set in x"); }
public void TestIsSetWithLong() { long x = AA | DD; Assert.IsTrue(Bit.IsSet(x, AA), "Expected: true, because AA is set in x"); Assert.IsFalse(Bit.IsSet(x, BB), "Expected: false, because BB is not set in x"); Assert.IsTrue(Bit.IsSet(x, DD), "Expected: true, because DD is set in x"); }
public void TestIsSetWithEnum() { X x = X.A | X.D; Assert.IsTrue(Bit.IsSet(x, X.A), "Expected: true, because A is set in x"); Assert.IsFalse(Bit.IsSet(x, X.B), "Expected: false, because B is not set in x"); Assert.IsTrue(Bit.IsSet(x, X.D), "Expected: true, because D is set in x"); }
/// <summary> /// testet, ob das Bit gesetzt ist /// </summary> /// <param name="b"></param> /// <param name="bit"></param> /// <returns></returns> protected bool BitIsSet(byte b, byte bit) { return(Bit.IsSet(b, bit)); }