microlibrary

Integer Utilities

Integer utilities are defined in the microlibrary static library’s microlibrary/integer.h/microlibrary/integer.cc header/source file pair. Integer utilities automated tests are defined in the test-automated-microlibrary-integer automated test executable’s main.cc source file.

Table of Contents

  1. to_unsigned()
  2. highest_bit_set()
  3. mask()
  4. reflect()
  5. is_power_of_two()

to_unsigned()

To convert a potentially signed integer to its bitwise unsigned integer equivalent, use the ::microlibrary::to_unsigned() utility.

highest_bit_set()

To lookup an unsigned integer value’s highest bit set, use the ::microlibrary::highest_bit_set() utility.

mask()

To create a bit mask, use the ::microlibrary::mask() utility.

reflect()

To reflect an unsigned integer’s bits, use the ::microlibrary::reflect() utility.

is_power_of_two()

To check if an unsigned integer is a power of two, use the ::microlibrary::is_power_of_two() utility.