メインコンテンツ

hisl_0073: Usage of bit-shift operations

R2026b

Avoid shift operations greater than or equal to the bit-width to prevent violations of coding standards

Usage: High-Integrity System Modeling

Guideline ID: hisl_0073

Rules

hisl_0073: Usage of bit-shift operations

For bit-shifting operations (for example, a >> b or a << b), do not perform shift operations that are greater than or equal to the bit-width (b must not be equal or greater than the bit width of a).

Rationale

Generation of code with shift operations can result in violation of coding standards.

Verification

Check usage of bit-shift operations (Simulink Check)

Industry Standards

  • DO-331 Section MB.6.3.1.b 'High-level requirements are accurate and consistent'

    DO-331 Section MB.6.3.2.b 'Low-level requirements are accurate and consistent'

  • IEC 61508–3, Table A.3 (2) Strongly typed programming language

    IEC 61508–3, Table A.4 (3) Defensive programming

  • 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.3 (1) Defensive Programming

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

  • 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 12.2

  • MISRA C:2023, Rule 12.2

  • INT34-C. Do not shift an expression by a negative number of bits or by greater than or equal to the number of bits that exist in the operand

Version History

Introduced in R2021b

expand all