I'm trying to implement bitboards in Swift and am trying to store a 64bit integer into a UInt64 and get an overflow error.
var white_queen_bb:uint64 = 0001000000000000000000000000000000000000000000000000000000000000 as UInt64;
Integer Literal '100000000000000000000000000000000000000000000000000000000000' overflows when stored into 'UInt64'
You're right. Swift by default treats numbers as decimal.
let i: UInt64 = 0100 would have the decimal value 100.
If you want to use a binary number in Swift, use the
let j: UInt64 = 0b0100 would have a decimal value of 4.