def update(state, output_channel, value)
      raise RangeError if output_channel >= NUM_OUTPUTS

      mask = (1 << output_channel + NUM_INPUTS)
      value.zero? ? state & ~mask : state | mask
    end
def update(state, output_channel, value)
      raise RangeError if output_channel >= NUM_OUTPUTS

      mask = (1 << output_channel + NUM_INPUTS)
      value.zero? ? state & ~mask : state | mask
    end
@raise [RangeError] if the given channel index exceeds the number of
   available output channels.

 @param  state [Integer] the current state.
 @param  output_channel [Integer] the output channel number.
 @param  value [0,Integer] the value to update with.
 @return [Integer] the next state.