Preserve unsigned 64-bit values in the DBC decoder #2

Closed
opened 2026-10-01 17:05:53 +00:00 by deeaitch · 0 comments
Owner

Description:
The decoder stores all raw signal values in std::int64_t, including unsigned signals. Unsigned 64-bit values above INT64_MAX therefore cannot be represented correctly, and physical values are calculated from an incorrect signed value.
Reproduction:

  • Signal: startBit=0, length=64, ByteOrder::Intel, unsigned, factor 1, offset 0.
  • Payload: {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}.
  • Expected raw value: 18446744073709551615 (UINT64_MAX).
  • Actual raw value on the current build: -1.
  • Expected physical value: the double approximation of UINT64_MAX.
  • Actual physical value: -1.
    Scope:
  • Update DecodedSignalValue to preserve signed and unsigned raw values without loss.
  • Calculate physical values using the signal’s numeric type.
  • Update demo output to display both numeric types correctly.
  • Add regression tests for unsigned values at and above INT64_MAX, including UINT64_MAX, in both Intel and Motorola byte order.
  • Verify signed decoding and scaling remain correct.
  • Document the result representation and the precision limits of double.
  • Use TypeFactory wherever it meaningfully simplifies the implementation.
  • Do not modify generated docs.
    Acceptance criteria:
  • Unsigned raw values remain exact across the full 64-bit range.
  • Signed raw values remain correct, including INT64_MIN and INT64_MAX.
  • Physical conversion uses the correct signed or unsigned value.
  • Demo output displays unsigned values without wrapping into negative numbers.
  • Existing and new regression tests pass.
  • The project builds without warnings using -Wall -Wextra -Wpedantic -Werror
Description: The decoder stores all raw signal values in std::int64_t, including unsigned signals. Unsigned 64-bit values above INT64_MAX therefore cannot be represented correctly, and physical values are calculated from an incorrect signed value. Reproduction: - Signal: startBit=0, length=64, ByteOrder::Intel, unsigned, factor 1, offset 0. - Payload: {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}. - Expected raw value: 18446744073709551615 (UINT64_MAX). - Actual raw value on the current build: -1. - Expected physical value: the double approximation of UINT64_MAX. - Actual physical value: -1. Scope: - Update DecodedSignalValue to preserve signed and unsigned raw values without loss. - Calculate physical values using the signal’s numeric type. - Update demo output to display both numeric types correctly. - Add regression tests for unsigned values at and above INT64_MAX, including UINT64_MAX, in both Intel and Motorola byte order. - Verify signed decoding and scaling remain correct. - Document the result representation and the precision limits of double. - Use TypeFactory wherever it meaningfully simplifies the implementation. - Do not modify generated docs. Acceptance criteria: - Unsigned raw values remain exact across the full 64-bit range. - Signed raw values remain correct, including INT64_MIN and INT64_MAX. - Physical conversion uses the correct signed or unsigned value. - Demo output displays unsigned values without wrapping into negative numbers. - Existing and new regression tests pass. - The project builds without warnings using -Wall -Wextra -Wpedantic -Werror
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: automotive/dbc#2