@intCast

@intCast

@intCast(comptime DestType: type, int: anytype) DestType

Converts an integer to another integer while keeping the same numerical value. Attempting to convert a number which is out of range of the destination type results in safety-protected Undefined Behavior.

If T is comptime_int, then this is semantically equivalent to Type Coercion.