# File lib/ruby-vpi/integer.rb, line 101 101: def unpack aPackedWidth 102: bits = length 103: 104: unless aPackedWidth >= bits 105: raise ArgumentError, "packed width #{aPackedWidth} must be at least #{bits} for integer #{self}" 106: end 107: 108: mask = aPackedWidth.to_mask 109: result = self & mask 110: 111: if result[aPackedWidth - 1] == 1 112: -((-result) & mask) 113: else 114: result 115: end 116: end