toU32
이 페이지에서

toU32()

함수, 내장 함수 분류

Convert to u32: the explicit numeric cast, where u32(/api/u32/) builds a literal from a JS number.

import { toU32 } from 'typeshade'

시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.

구문

const toU32: (x: ReadonlyNode<string> | number) => Node<"u32">

매개변수

x ReadonlyNode<string> | number

반환값

Node<'u32'>

설명

Emits u32(x) on WGSL and uint(x) on GLSL. Use it over toI32 wherever the context is unsigned, such as a buffer stride.

예제

예제

import { fn, toU32, f32T } from 'typeshade'
const idx = fn('idx', { anchorMode: f32T }, ({ anchorMode }) => toU32(anchorMode))

대상별 지원

대상지원비고
WGSL (WebGPU) 지원

u32(x).

GLSL ES 3.00 (WebGL2) 지원

uint(x).

CPU 오라클 지원

Evaluated in f64 by the oracle.

함께 보기

소스

src/core/ir/node.ts, 2426행, 커밋 c66579bf 기준

이 페이지 편집 문제 보고