i32
이 페이지에서

i32()

함수, 값 분류

An i32 literal node.

import { i32 } from 'typeshade'

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

구문

function i32(v: number): Node<'i32'>;
function i32(x: ReadonlyNode<ScalarCastSource>): Node<'i32'>;

매개변수

v number

반환값

Node<'i32'>

예외

TypeError

v is neither a JS number nor a scalar node.

SD0116

SD0116 when the node operand is not a scalar.

설명

Use it over the f32 default wherever a value must type-check as a signed integer: array and loop indices, matchExpr and matchEnum scrutinees, texture layer arguments.

A Node argument is a cast instead: i32(x) converts, the free-function twin of x.i32(). It builds what toI32 builds, and its operand is bounded to a scalar.

예제

예제

import { i32 } from 'typeshade'
const zero = i32(0) // Node<'i32'>

대상별 지원

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

i32(a).

GLSL ES 3.00 (WebGL2) 지원

int(a).

CPU 오라클 지원

Evaluated in f64 by the oracle.

관련 가이드

함께 보기

소스

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

이 페이지 편집 문제 보고