firstLeadingBit
On this page

firstLeadingBit

Function

The position of the most significant 1 bit of a u32 (0xffffffff for zero), or of the most significant bit that differs from the sign bit of an i32 (-1 for 0 and -1).

The signature and the sentence under each name are the compiler's own text at commit 26de7be8.

Syntax

declare function firstLeadingBit<V extends vec2i | vec3i | vec4i | vec2u | vec3u | vec4u>(a0: V): V
declare function firstLeadingBit<P0 extends number>(a0: P0): ([P0] extends [boolean] ? bool : typeof f32Tag extends keyof P0 ? f32 : typeof i32Tag extends keyof P0 ? i32 : typeof u32Tag extends keyof P0 ? u32 : typeof f64Tag extends keyof P0 ? f64 : number)
declare function firstLeadingBit<T extends Numeric>(a0: T): T

A number in a parameter or a return position is the scalar slot. The ambient file declares a GPU scalar as a branded number whose brand is optional, so a literal and any branded scalar both fill it.

type f32 = number & { readonly [f32Tag]?: true }

A declaration you write still needs a width, and a bare number on a field or a parameter is refused; the TypeScript constructs page carries that row with the compiler's own message.

A signature may name a type the ambient file declares for its own use. These are those declarations.

Numeric
type Numeric = number | vec2 | vec3 | vec4 | vec2i | vec3i | vec4i | vec2u | vec3u | vec4u

Parameters

A parameter named by position (a0, a1) carries a name the ambient file generates. A call passes its arguments in order and names none of them.

  • a0 VP0T

Return value

V([P0] extends [boolean] ? bool : typeof f32Tag extends keyof P0 ? f32 : typeof i32Tag extends keyof P0 ? i32 : typeof u32Tag extends keyof P0 ? u32 : typeof f64Tag extends keyof P0 ? f64 : number)T

Description

A _msb helper on GLSL ES 3.00.

Targets

WGSL
firstLeadingBit(a)
GLSL ES 3.00
_msb(a)

Examples

See also

Edit this page Report a problem