Skip to content

Commit

Permalink
Fix type
Browse files Browse the repository at this point in the history
  • Loading branch information
hackenbergstefan committed Aug 5, 2022
1 parent cd671a5 commit 25ac6b6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pygti2/device_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from .elfbackend import CType, CTypeArray, CTypeFunction, ElfBackend


def junks(thelist, junksize):
for i in range(0, len(thelist), junksize):
yield thelist[i : i + junksize]
def chunks(thelist, chunksize):
for i in range(0, len(thelist), chunksize):
yield thelist[i : i + chunksize]


def uint2int(value, size):
Expand Down Expand Up @@ -135,7 +135,7 @@ def get_value(self):
content = self.to_bytes()
if self.is_primitive:
values = []
for part in junks(content, self._type.size):
for part in chunks(content, self._type.size):
value = int.from_bytes(part, self._backend.endian)
if getattr(self._type, "signed", False) and value >> (8 * self._type.size - 1) != 0:
value = value - int.from_bytes(self._type.size * b"\xff", self._backend.endian) - 1
Expand Down

0 comments on commit 25ac6b6

Please sign in to comment.