In C, I am able to do a trick with numbers:
uint8_t value = 0
int delta = -1
uint8_t result = value + delta /* result will be 0xFF */
Is there a way of doing the same in Swift? Notice that the same approach doesn't work:
let value: UInt8 = 0
let delta: Int = -1
var result: UInt8 = value + delta // Error, even typecasting in different ways...
Is there a way to get C's behaviour for substraction in Swift?
Thanks!