Exemplo n.º 1
0
    def _min_max(self):
        numtype = self.numtype
        bits = self.bits
        signed = self.signed

        # Calculate the minimum and maximum possible values for error checking
        min_value = from_sortable(numtype, bits, signed, 0)
        max_value = from_sortable(numtype, bits, signed, 2 ** bits - 1)

        return min_value, max_value
Exemplo n.º 2
0
 def from_bytes(self, bs):
     x = self._struct.unpack(bs[1:])[0]
     x = from_sortable(self.numtype, self.bits, self.signed, x)
     x = self.unprepare_number(x)
     return x
Exemplo n.º 3
0
 def from_column_value(self, x):
     x = from_sortable(self.numtype, self.bits, self.signed, x)
     return self.unprepare_number(x)
Exemplo n.º 4
0
 def from_bytes(self, bs):
     x = self._struct.unpack(bs[1:])[0]
     x = from_sortable(self.numtype, self.bits, self.signed, x)
     x = self.unprepare_number(x)
     return x
Exemplo n.º 5
0
 def from_column_value(self, x):
     x = from_sortable(self.numtype, self.bits, self.signed, x)
     return self.unprepare_number(x)