def unpack(self, data):
if not isinstance(data, _Bits):
data = _Bits(data)
for i in range(self.count):
offset = i*self.size
try:
b = data[offset:offset + self.size]
self._values[i] = self.logical_range.scale_to(self.physical_range, b.int if self.logical_range.minimum<0 else b.uint)
except ArithmeticError:
# If the value is outside of the logical range, and NULLs are allowed, then do not modify the value
if not self.flags & ReportFlags.NULL_STATE:
raise
评论列表
文章目录