Esempio n. 1
0
 def __init__(self, value, width=None):
     if width is not None:
         if width not in self.widths:
             raise ValueError("{} width {!r} not in {!r}".format(typename(self), width, self.widths))
         lower = 0
         upper = 2 ** (width * 8)
         if not (lower <= value < upper):
             raise ValueError("{} value {!r} out of range {} to {} for {} byte width".format(typename(self), value,
                                                                           lower, upper - 1, width))
     self._value = value
     self._width = width
Esempio n. 2
0
 def __repr__(self):
     return "{}({})".format(typename(self), self._mnemonic)
Esempio n. 3
0
 def __init__(self, value):
     if not (-2147483648 <= value < 2147483647):
         raise ValueError("{} value {!r} out of range".format(
             typename(self), value))
     self._value = value
Esempio n. 4
0
 def __init__(self, value):
     if not (-32768 <= value < 32767):
         raise ValueError("{} value {!r} out of range".format(
             typename(self), value))
     self._value = value
Esempio n. 5
0
 def __repr__(self):
     return "{}({!r}, {!r})".format(typename(self), self._value, self._width)