Skip to content

Commit

Permalink
Merge 921f03b into d8d93af
Browse files Browse the repository at this point in the history
  • Loading branch information
cdonovick committed Jun 12, 2019
2 parents d8d93af + 921f03b commit b4cc342
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hwtypes/bit_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def as_uint(self):

def as_sint(self):
value = self._value
if (value & (1 << (self.size - 1))):
if self[-1]:
value = value - (1 << self.size)
return value

Expand Down Expand Up @@ -485,6 +485,6 @@ def overflow(a, b, res):
msb_a = a[-1]
msb_b = b[-1]
N = res[-1]
return (msb_a & msb_b & ~N) or (~msb_a & ~msb_b & N)
return (msb_a & msb_b & ~N) | (~msb_a & ~msb_b & N)

_Family_ = TypeFamily(Bit, BitVector, UIntVector, SIntVector)

0 comments on commit b4cc342

Please sign in to comment.