bitworks/hwo.bitworks/BComplement.cs

27 lines
492 B
C#

using System;
namespace hwo.bitworks
{
public class BComplement : MultipleBitsSource
{
Invert invert;
ADDX addx;
public BComplement(LogicBase[] sources)
:base(sources)
{
invert = new Invert(sources);
addx = new ADDX(invert.getLogicalBases(),new LogicBase[]{Constants.ONE});
}
public override bool bitValue(int bit)
{
return addx.bitValue(bit);
}
public override identity.BitIdentity getBitIdentity(int bit){
return addx.getBitIdentity(bit);
}
}
}