Namespaces
Variants
Actions

Bit manipulation (since C23)

From cppreference.com
< c‎ | numeric
 
C
 
Numerics
 
Bit manipulation

Contents

Functions

Defined in header <stdbit.h>
counts the number of consecutive 0 bits, starting from the most significant bit
(type-generic function macro)[edit]
counts the number of consecutive 1 bits, starting from the most significant bit
(type-generic function macro)[edit]
counts the number of consecutive 0 bits, starting from the least significant bit
(type-generic function macro)[edit]
counts the number of consecutive 1 bits, starting from the least significant bit
(type-generic function macro)[edit]
finds the first position of 0 bit, starting from the most significant bit
(type-generic function macro)[edit]
finds the first position of 1 bit, starting from the most significant bit
(type-generic function macro)[edit]
finds the first position of 0 bit, starting from the least significant bit
(type-generic function macro)[edit]
finds the first position of 1 bit, starting from the least significant bit
(type-generic function macro)[edit]
counts the number of 0 bits in an unsigned integer
(type-generic function macro)[edit]
counts the number of 1 bits in an unsigned integer
(type-generic function macro)[edit]
checks if a number is an integral power of 2
(type-generic function macro)[edit]
finds the smallest number of bits needed to represent the given value
(type-generic function macro)[edit]
finds the largest integral power of 2 not greater than the given value
(type-generic function macro)[edit]
finds the smallest integral power of 2 not less than the given value
(type-generic function macro)[edit]

Macro constants

Defined in header <stdbit.h>
indicates the endianness of scalar types
(macro constant) [edit]

[edit] References

  • C23 standard (ISO/IEC 9899:2024):
  • 7.18 Bit and byte utilities <stdbit.h>

[edit] See also

C++ documentation for Bit manipulation

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant