1
0
mirror of https://github.com/myhdl/myhdl.git synced 2025-01-24 21:52:56 +08:00

Correction to make a 1 bit "signed" intbv possible

This commit is contained in:
Jan Decaluwe 2008-06-17 22:31:06 +02:00
parent 61d779e738
commit 525be5c500

View File

@ -44,10 +44,9 @@ class intbv(object):
self._min = min
self._max = max
if max is not None and min is not None:
_nrbits = maxfunc(len(bin(max-1)), len(bin(min)))
if min >= 0:
_nrbits = len(bin(max-1))
elif max <= 0:
elif max <= 1:
_nrbits = len(bin(min))
else:
# make sure there is a leading zero bit in positive numbers