Skip to content

Commit

Permalink
wipe the used bits of an object before the actual data is placed
Browse files Browse the repository at this point in the history
this allows to ignore garbage data which might be located at an
object's position. Additionally, only set the bits which are actually
used by the object to be placed.

Signed-off-by: Andreas Lauser <[email protected]>
Signed-off-by: Alexander Walz <[email protected]>
  • Loading branch information
andlaus committed Apr 26, 2024
1 parent f325e8f commit 3f5012c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions odxtools/encodestate.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,12 @@ def emplace_bytes(self,
for i in range(len(new_data)):
if self.used_mask[pos + i] & obj_used_mask[i] != 0:
warnings.warn(
"Overlapping objects detected",
f"Overlapping objects detected at position {pos + i}",
OdxWarning,
stacklevel=1,
)
self.coded_message[pos + i] |= new_data[i]
self.coded_message[pos + i] &= ~obj_used_mask[i]
self.coded_message[pos + i] |= new_data[i] & obj_used_mask[i]
self.used_mask[pos + i] |= obj_used_mask[i]

self.cursor_byte_position += len(new_data)

0 comments on commit 3f5012c

Please sign in to comment.