[swift-users] Bool to Int

Rick Mann rmann at latencyzero.com
Sun Nov 20 21:48:26 CST 2016


It seems I can't do this:

let r = Int(a > b)

but I can do it with a literal:

let r = Int(true)

I'd like to do this to implement signum without branching, but perhaps that's not possible.

-- 
Rick Mann
rmann at latencyzero.com




More information about the swift-users mailing list