Hauptinhalt

hisl_0019: Usage of bitwise operations

R2026b

Avoid bitwise operations on signed integer data types to prevent unpredictable behavior in generated code

Usage: High-Integrity System Modeling

Guideline ID: hisl_0019

Rules

hisl_0019: Usage of bitwise operations

To support unambiguous behaviour, when using bitwise operations, avoid bitwise operations on signed integer data types.

Rationale

Support unambiguous behavior of generated code.

Verification

Check usage of bit operation blocks (Simulink Check)

Tips

  • Bitwise operations are not meaningful on signed integers due to unpredictable behaviour. For example, a shift operation might move the sign bit into the number, or a numeric bit into the sign bit.

Industry Standards

  • DO-331, Section MB.6.3.2.g 'Algorithms are accurate'

  • IEC 61508-3, Table A.3 (3) 'Language subset'

    IEC 61508-3, Table A.3 (2) 'Strongly typed programming language'

  • IEC 62304, 5.5.3 - Software Unit acceptance criteria

  • ISO 26262-6, Table 1 (1b) 'Use of language subsets'

    ISO 26262-6, Table 1 (1c) 'Enforcement of strong typing'

    ISO 26262-6, Table 1 (1d) 'Use of defensive implementation techniques'

  • EN 50128, Table A.4 (11) 'Language Subset'

    EN 50128, Table A.3 (1) 'Defensive Programming'

    EN 50128, Table A.4 (8) 'Strongly Typed Programming Language'

  • EN 50657, Table A.4 (11) 'Language Subset'

    EN 50657, Table A.3 (1) 'Defensive Programming'

    EN 50657, Table A.4 (8) 'Strongly Typed Programming Language'

  • EN 50716, Table A.3 (1) 'Defensive Programming'

  • MISRA C:2012, Rule 10.1

  • MISRA C:2023, Rule 10.1

Version History

Introduced in R2010a

expand all