Uploaded image for project: 'SonarCFamily'
  1. SonarCFamily
  2. CPP-3019

Rule S6228: "std::has_single_bit" should be used to test if an integer is a power of two

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.24
    • Component/s: C++, Rules
    • Labels:

      Description

      Use std::has_single_bit to check if number is power of two (has single bit in representation), instead of bit hacks involving x & (x-1).

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              amelie.renard Amélie Renard
              Reporter:
              tomasz.kaminski Tomasz Kamiński
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: