Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unknown parameter UInt8 in '_specialize attribute': Xcode 9

This code used for building bit pattern from array of bits gives me error in Xcode 9 (works in 8.3.3)

@_specialize(UInt8)
func integerFrom<T: UnsignedInteger>(_ bits: Array<Bit>) -> T {
    var bitPattern: T = 0
    for idx in bits.indices {
        if bits[idx] == Bit.one {
            let bit = T(UIntMax(1) << UIntMax(idx))
            bitPattern = bitPattern | bit
        }
    }
    return bitPattern
}

Error

Unknown parameter UInt8 in '_specialize attribute'

Any leads/suggestion on this?

like image 424
Sahil Kapoor Avatar asked Jun 14 '17 07:06

Sahil Kapoor


1 Answers

You just need to include a where clause in the specialize definition like this

@_specialize(where T == UInt8)
like image 186
Fran Martin Avatar answered Oct 12 '22 02:10

Fran Martin