fn absCast(x: anytype) switch (@typeInfo(@TypeOf(x))) {
    .ComptimeInt => comptime_int,
    .Int => |int_info| std.meta.Int(.unsigned, int_info.bits),
    else => @compileError("absCast only accepts integers"),
}

Returns the absolute value of the integer parameter. Converts result type to unsigned if needed and returns a value of an unsigned integer type. Use absInt if you want to keep your integer type signed.

Parameters

x: anytype,