# File lib/ruby-vpi/integer.rb, line 97
  def extend_sign aOrigWidth, aExtWidth
    result = self
    maskWidth = aExtWidth - aOrigWidth

    if maskWidth > 0 && result[aOrigWidth - 1] == 1
      result |= (maskWidth.to_mask << aOrigWidth)
    end

    result & aExtWidth.to_mask
  end