C++ BIT Library Introduction

C++ BIT Library Introduction

Introduction to BIT Library Header

Bit is a standard numeric library header.

The numeric library header includes a set of algorithms which help in performing operations on   values/sequences of numeric values.

 For ex: square_root,partial_sum of given range in arrays along with:

  •  popular mathematical functions.
  •  numeric arrays.
  • random number generator.

Few Functions of the Bit library are::

rotl                   computes  bitwise left-rotation
rotr                   computes  bitwise right-rotation.

bit_cast              can be used when it is needed to interpret the object representation as                                    one of another type.

bit_ceil                 finds the ceiling value of the smallest integral power of two.

bit_floor             finds the floor value of the largest integral power of two.

bit_width              finds the smallest number of bits needed to represent the given value.

has_single_bit   checks if number is power of two.

countl_zero       from the MSB,counts  consecutive 0 bits.

countl_one         from the MSB,counts  consecutive 1 bits.

countr_zero       from the LSB,counts  consecutive 0 bits.

countr_one         from the LSB,counts  consecutive 1 bits.