Skip to content

Commit ba4c676

Browse files
Karl Schärlundhardbyte
authored andcommitted
Refactor to save calculations
1 parent 6d44fd0 commit ba4c676

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

can/io/blf.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,9 @@ def __iter__(self):
197197
obj_size = header[3]
198198
obj_type = header[4]
199199
# Calculate position of next object
200-
if obj_size % 4 and obj_type != CAN_FD_MESSAGE_64:
201-
next_pos = pos + obj_size + (obj_size % 4)
202-
else:
203-
# CAN_FD_MESSAGE_64 objects are not padded to 4 bytes.
204-
next_pos = pos + obj_size
200+
next_pos = pos + obj_size
201+
if obj_type != CAN_FD_MESSAGE_64:
202+
next_pos += obj_size % 4
205203
if next_pos > len(data):
206204
# Object continues in next log container
207205
break

0 commit comments

Comments
 (0)