Skip to content

Commit

Permalink
Update fibex.py (#802)
Browse files Browse the repository at this point in the history
  • Loading branch information
SabrineBH committed Jun 21, 2024
1 parent dbc96d9 commit e9b2972
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/canmatrix/formats/fibex.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,8 +788,10 @@ def dump(db, f, **options):
"Coding for " +
signal_id)

coded = create_sub_element_ho(coding, "CODED-TYPE")
base_data_type = get_base_data_type(signal.size, signal.is_signed)
coded = create_sub_element_ho(coding, "CODED-TYPE")
# find smallest predefined type size able of holding signal size
byte_size = (signal.size + 8 - 1) / 8
base_data_type = get_base_data_type(byte_size * 8, signal.is_signed)
if base_data_type is not None:
coded.set(ns_ho + "BASE-DATA-TYPE", base_data_type)
coded.set("CATEGORY", "STANDARD-LENGTH-TYPE")
Expand Down

0 comments on commit e9b2972

Please sign in to comment.