I have trouble trying to convert Int64 to byte array. App fails when value
is negative.
This is what I have in my playground:
let value: Int64 = -1
let byte1: UInt8 = UInt8((value >> 56) | Int64(0xFF))
let byte2: UInt8 = UInt8((value >> 48) | Int64(0xFF))
let byte3: UInt8 = UInt8((value >> 40) | Int64(0xFF))
let byte4: UInt8 = UInt8((value >> 32) | Int64(0xFF))
let byte5: UInt8 = UInt8((value >> 24) | Int64(0xFF))
let byte6: UInt8 = UInt8((value >> 16) | Int64(0xFF))
let byte7: UInt8 = UInt8((value >> 8) | Int64(0xFF))
let byte8: UInt8 = UInt8(value & Int64(0xFF))
I'm not sure (can't check right now) but same code works in the c++-port.