Panther Search Documentation Tutorials Devlog Downloads Source Code

Type Conversion Intrinsics

Panther
Documentation


@bitCast

func @bitCast = <{FROM: Type, TO: Type}> (from: FROM) -> TO;

Convert a value of any type to any other of the same size. Requires that @sizeOf<{FROM}>() == @sizeOf<{TO}>(). FROM and TO must be different types.

@trunc

func @trunc = <{FROM: Type, TO: Type}> (from: FROM) -> TO;

Truncate any integral type to any other smaller integral type. Both FROM and TO must be integral or a vector of integral. Requires @sizeOf<{FROM}>() > @sizeOf<{TO}>(). If is a vector, the lenghts of the vectors must be the same size.

@ftrunc

func @ftrunc = <{FROM: Type, TO: Type}> (from: FROM) -> TO;

Truncate any floating-point type to any other smaller floating-point type. Both FROM and TO must be floating-point or a vector of floating-point. Requires the floating-point width of FROM to be greater than that of TO. If is a vector, the lenghts of the vectors must be the same size.

@sext

func @sext = <{FROM: Type, TO: Type}> (from: FROM) -> TO;

Sign extend any integral type to any other larger integral type. Both FROM and TO must be integral or a vector of integral. Requires @sizeOf<{FROM}>() < @sizeOf<{TO}>(). If is a vector, the lenghts of the vectors must be the same size.

@zext

func @zext = <{FROM: Type, TO: Type}> (from: FROM) -> TO;

Zero extend any integral type to any other larger integral type. Both FROM and TO must be integral or a vector of integral. Requires @sizeOf<{FROM}>() < @sizeOf<{TO}>(). If is a vector, the lenghts of the vectors must be the same size.

@fext

func @fext = <{FROM: Type, TO: Type}> (from: FROM) -> TO;

Extend any floating-point type to any other larger floating-point type. Both FROM and TO must be floating-point or a vector of floating-point. Requires the floating-point width of FROM to be smaller than that of TO. If is a vector, the lenghts of the vectors must be the same size.

@iToF

func @iToF = <{FROM: Type, TO: Type}> (from: FROM) -> TO;

Convert any integral or vector of integral type to any floating-point type. FROM must be integral and TO must be floating-point.

@fToI

func @fToI = <{FROM: Type, TO: Type}> (from: FROM) -> TO;

Convert any floating-point or vector of floating-point type to any integral. FROM must be floating-point and TO must be integral.