I'm working with the Pebble accelerometer data and need to convert the unsigned representations of negative ints to normal numbers (note the first two for example).
[X: 4294967241, Z: 4294967202, Y: 22]
[X: 4294967278, Z: 4294967270, Y: 46]
[X: 4294967274, Z: 4294967278, Y: 26]
[X: 4294967221, Z: 85, Y: 4294967280]
[X: 4294967247, Z: 117, Y: 4294967266]
Using Objective C I've managed to do so by the simple [number intValue]
. However, using Swift I can't find a way to do so. I've tried Int(number)
, but I get the same value.