SuperGeroy / Sage

A cross-platform chess library for Swift
Apache License 2.0
4 stars 2 forks source link

How to substitute deprecated BitwiseOperations protocol? #3

Closed SuperGeroy closed 5 years ago

SuperGeroy commented 5 years ago

The Bitboard struct uses the deprecated BitwiseOperations protocol (see line 562 of Bitboard.swift). As support for Swift 3 will be removed in XCode 10.2 I need some help in replacing the protocol. XCode suggests using the FixedWidthInteger protocol instead but I think we only need the BinaryInteger protocol.

For this to work, we need to implement typealiases for Words and Magnitude and here I am struggling at the moment. I will try to find the solution for Sage to continue to work with XCode 10.2 and Swift 4. Requirement for typealias Magnitude comes from protocol Numeric. (Currently, I tend to use UInt64 as typealias.)

tomzr commented 5 years ago

As long as bitboard uses UInt64 as raw value asliasing for that is ok. Anyway it seems as a lot of code just delegating binary operations to raw value and recreating bitboard again (will it be slow?)

SuperGeroy commented 5 years ago

I found the solution: Sage does neither need the FixedWidthInteger nor the BinaryInteger protocol to run with Swift 4.2. It now works on my machine with XCode 10.2.1. I will upload the solution soon.