From 0f875401dcb5955cc7c56e2f77ab3e4ff6672939 Mon Sep 17 00:00:00 2001 From: Chris Gerth Date: Sun, 22 Sep 2024 19:44:19 -0500 Subject: [PATCH] reversed byte order --- photon-lib/py/photonlibpy/packet.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/photon-lib/py/photonlibpy/packet.py b/photon-lib/py/photonlibpy/packet.py index 53c3f84c5..fee574ebd 100644 --- a/photon-lib/py/photonlibpy/packet.py +++ b/photon-lib/py/photonlibpy/packet.py @@ -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