fix big_endian
@@ -115,7 +115,13 @@ def decode_data(data: bytes,
# remove signal that are outside available data bytes
valid_bit_count = actual_length * 8
for signal in fields:
- if signal.start + signal.length > valid_bit_count:
+ if signal.byte_order == "little_endian":
+ sequential_startbit = signal.start
+ else:
+ # calculate startbit with inverted indices
+ sequential_startbit = 7 - signal.start % 8 + (signal.start // 8) * 8
+
+ if sequential_startbit + signal.length > valid_bit_count:
del unpacked[signal.name]
decoded = {}
