Multiply a and b. Return type is wide enough to guarantee no overflow.
pub fn mulWide(comptime T: type, a: T, b: T) @Int(
@typeInfo(T).int.signedness,
@typeInfo(T).int.bits * 2,
)
pub fn mulWide(comptime T: type, a: T, b: T) @Int(
@typeInfo(T).int.signedness,
@typeInfo(T).int.bits * 2,
) {
const ResultInt = @Int(
@typeInfo(T).int.signedness,
@typeInfo(T).int.bits * 2,
);
return @as(ResultInt, a) * @as(ResultInt, b);
}