Swift: Madness of Generic Integer

Handling Integers with Swift is not the easiest task. Especially when I need the generic function that can do some work on any kind of Integer. There are 11 Integer types that can be considered as Integers: * Int8 * UInt8 * Int16 * UInt16 * Int32 * UInt32 * Int64 * UInt64 * Int * UInt * Bit (I'…

Swift Integer Overflow issue

Recently I had this conversation on bugreport.apple.com with Apple engineer. I filled report that application will crash when initialized with bigger value than can be stored in initialized object, as a respond > “determined that this issue behaves as intended. UInt8(u) is a checked conversion. 773162 is…

Swift: Bit type with Generics

Note to myself: Some informations here may be outdated due to lated changes in Swift language. It might be surprising that High Level language like Swift [https://developer.apple.com/swift/] have dedicated Bit type. It’s enum actually. Integer actually. enum Bit : Int, RandomAccessIndexType, Reflectable, IntegerArithmeticType { case Zero case…