countbits function

Counts the number of bits (per component) set in the input integer.

Syntax

uint countbits(
  in uint value
);

Parameters

value [in]

Type: uint

The input value.

Return value

Type: uint

The number of bits.

Remarks

The following overloaded versions are also available:

uint count_bits(uint value);
uint2 count_bits(uint2 value);
uint3 count_bits(uint3 value);
uint4 count_bits(uint4 value);

Minimum Shader Model

This function is supported in the following shader models.

Shader Model Supported
Shader Model 5 and higher shader models yes

 

This function is supported in the following types of shaders:

Vertex Hull Domain Geometry Pixel Compute
x x x x x x

 

See also

Intrinsic Functions

Shader Model 5