Skip to content

Commit

Permalink
save one map lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
deanlee committed Jun 7, 2024
1 parent 9666348 commit 1834bde
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions can/packer_pyx.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ cdef class CANPacker:
cdef const Msg* m
try:
if isinstance(name_or_addr, int):
m = self.dbc.addr_to_msg.at(name_or_addr)
address = name_or_addr
else:
m = self.dbc.name_to_msg.at(name_or_addr.encode("utf8"))
address = m.address
address = m.address
except IndexError:
# The C++ pack function will log an error message for invalid addresses
pass
Expand Down

0 comments on commit 1834bde

Please sign in to comment.