--- layout: stdlib-reference --- # firstbithigh ## Description Find first set bit starting at high bit and working down. ## Signature
int firstbithigh(int value);

vector<int, N> firstbithigh<N:int>(vector<int, N> value);

uint firstbithigh(uint value);

vector<uint, N> firstbithigh<N:int>(vector<uint, N> value);

## Generic Parameters #### N : int ## Parameters #### value : int The value to find set bits in. #### value : [vector](../types/vector/index.html)\ The value to find set bits in. #### value : uint The value to find set bits in. #### value : [vector](../types/vector/index.html)\ The value to find set bits in. ## Return value The bit index number of the most significant bit, or returns -1 if value is either 0 if value is a signed type and equal to -1. ## Remarks If value is unsigned, or signed with positive value, the bit index returned is the highest 1-bit. If value is signed with negative value, the bit index returned is the highest 0-bit. For SPIR-V, this function maps to GLSL extended instruction FindSMsb if value is signed, or FindUMsb if value is unsigned. ## Availability and Requirements Defined for the following targets: #### hlsl Available in all stages. #### glsl Available in all stages. #### cpp Available in all stages. #### cuda Available in all stages. #### metal Available in all stages. #### wgsl Available in all stages. #### spirv Available in all stages.