pub fn mulWide(comptime T: type, a: T, b: T) @Int( @typeInfo(T).int.signedness, @typeInfo(T).int.bits * 2, )
Multiply a and b. Return type is wide enough to guarantee no overflow.
T: type
a: T
b: T
1495 1496 1497 1498 1499 1500 1501 1502 1503 1504
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); }
Multiply a and b. Return type is wide enough to guarantee no overflow.