• Slang Standard Library Reference
    • Interfaces
    • Types
    • Attributes
    • Global Declarations
      • Atomic functions
      • Memory and control barriers
      • Bit operation functions
        • countbits
        • firstbithigh
        • firstbitlow
        • reversebits
      • Conversion functions
      • Derivative functions
      • Math functions
      • Mesh shading
      • Ray-tracing
      • Tessellation functions
      • Wave and quad functions
      • CheckAccessFullyMapped
      • D3DCOLORtoUBYTE4
      • EvaluateAttributeAtCentroid
      • EvaluateAttributeAtSample
      • EvaluateAttributeSnapped
      • GetAttributeAtVertex
      • GetRenderTargetSampleCount
      • GetRenderTargetSamplePosition
      • IsHelperLane
      • NonUniformResourceIndex
      • ReorderThread
      • WorkgroupSize
      • abort
      • all
      • any
      • clip
      • concat
      • createDynamicObject
      • cudaBlockDim
      • cudaBlockIdx
      • cudaThreadIdx
      • debugBreak
      • getRealtimeClock
      • getRealtimeClockLow
      • getStringHash
      • makeTuple
      • nextafter
      • printf
      • select
      • static_assert
      • unmodified
      • unused

firstbitlow

Description

Find first set bit starting at low bit and working up.

Signature

int firstbitlow(int value);

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

uint firstbitlow(uint value);

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

Generic Parameters

N : int

Parameters

value : int

The value to find set bits in.

value : vector<int, N>

The value to find set bits in.

value : uint

The value to find set bits in.

value : vector<uint, N>

The value to find set bits in.

Return value

The bit index number of the least significant set bit, or all ones (-1 when interpretted as signed) if value is 0.

Remarks

For SPIR-V, this function maps to GLSL extended instruction FindILsb.

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.