I am decoding sensor packets in Swift. let volts = raw * 3.3 / 4095 fails to compile with "binary operator '*' cannot be applied to operands of type 'Int' and 'Double'", and later a checksum computed as UInt8(sum) crashed at runtime when the sum exceeded 255. In C both lines work without any casts.
What are Swift's rules for mixing numeric types, and what is the right way to truncate or wrap a value on purpose, as a checksum needs?




