mirror of
https://github.com/myhdl/myhdl.git
synced 2024-12-14 07:44:38 +08:00
add __int__ magic method to EnumType
This commit is contained in:
parent
cb2332a37d
commit
1664847130
@ -85,6 +85,9 @@ def enum(*names, **kwargs):
|
||||
|
||||
__str__ = __repr__
|
||||
|
||||
def __int__(self):
|
||||
return int(self._val, 2)
|
||||
|
||||
def __hex__(self):
|
||||
return hex(int(self._val, 2))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user