#include <iostream>
      
      unsigned bits, var = (x < 0) ? -x : x;
      for(bits = 0; var != 0; ++bits) var >>= 1;
      
      Cpp language logo

      Bits length

      Codiga's C++ Recipes

      Get the length of bits of a variable

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.