diff --git a/lib/rcircuit/not.rb b/lib/rcircuit/not.rb index 3eb23c8..c828f49 100644 --- a/lib/rcircuit/not.rb +++ b/lib/rcircuit/not.rb @@ -1,13 +1,6 @@ # Represents a NOT gate class NotGate < Gate - # (see Gate#initialize) - def initialize(*args) - @outmask=0 - super - @outmask=(2**@width)-1 - end - # Add a port to the gate. As this is a NOT gate, there may only be one port. # @param (see Gate#add_input) # @return [void] @@ -22,6 +15,6 @@ class NotGate < Gate # Calculates NOT of input and sets output port to that value. # @param vals [Array] List of values for connected ports. def inputs_changed(vals) - out.setval((~vals[0]) & @outmask) + out.setval((~vals[0]) & ((2**@width)-1)) end end