Main Content

hisl_0073: Usage of bit-shift operations

ID: Titlehisl_0073: Usage of bit-shift operations
Description

For bit-shifting operations (e.g. 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).

RationaleGeneration of code with shift operations can result in violation of coding standards
Model Advisor ChecksCheck usage of bit-shift operations (Simulink Check)
References
  • 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

  • MISRA C:2012, 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

See Also

Create Tunable Calibration Parameter in the Generated Code (Simulink Coder)

Last ChangedR2021b