firstbithigh function

Gets the location of the first set bit starting from the highest order bit and working downward, per component.


int firstbithigh(
  in int value


value [in]

Type: int

The input value.

Return value

Type: int

The location of the first set bit.


For a signed integer, the first significant bit is zero for a negative number.

The following overloaded versions are also available:

int2 firstbithigh(int2 value);
int3 firstbithigh(int3 value);
int4 firstbithigh(int4 value);
uint firstbithigh(uint value);
uint2 firstbithigh(uint2 value);
uint3 firstbithigh(uint3 value);
uint4 firstbithigh(uint4 value);

Minimum Shader Model

This function is supported in the following shader models.

Shader ModelSupported
Shader Model 5 and higher shader modelsyes


This function is supported in the following types of shaders:



See also

Intrinsic Functions
Shader Model 5