Skip to content

Commit

Permalink
reversed byte order
Browse files Browse the repository at this point in the history
  • Loading branch information
gerth2 committed Sep 23, 2024
1 parent 286c1a1 commit 0f87540
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions photon-lib/py/photonlibpy/packet.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ def _decodeGeneric(self, unpackFormat, numBytes):
for _ in range(numBytes):
intList.append(self._getNextByteAsInt())

# Interpret the bytes as a floating point number
value = struct.unpack(unpackFormat, bytes(intList))[0]
# Interpret the bytes as the requested type.
# Note due to NT's byte order assumptions,
# we have to flip the order of intList
value = struct.unpack(unpackFormat, bytes(reversed(intList)))[0]

return value

Expand Down

0 comments on commit 0f87540

Please sign in to comment.