ModularM
Modular3y ago
8 replies
sa-code

Branchless way to convert bool to int?

Right now I do something like
# assuming b is a bool
let x = 1 if b else 0

Is there a way to do this in a branchless way? b.to_int() doesn't exist
Was this page helpful?