toI32
이 페이지에서

toI32()

함수, 내장 함수 분류

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

import { toI32 } from 'typeshade'

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

구문

const toI32: (x: ReadonlyNode<string> | number) => Node<"i32">

매개변수

x ReadonlyNode<string> | number

반환값

Node<'i32'>

설명

Emits i32(x) on WGSL and int(x) on GLSL. Use it to turn a computed f32 or u32 node into an integer index or scrutinee.

예제

예제

import { fn, toI32, f32T } from 'typeshade'
const idx = fn('idx', { u: f32T }, ({ u }) => toI32(u.mul(16)))

대상별 지원

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

i32(x).

GLSL ES 3.00 (WebGL2) 지원

int(x).

CPU 오라클 지원

Evaluated in f64 by the oracle.

함께 보기

소스

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

이 페이지 편집 문제 보고