2017-09-27 11 views
1

妥当な時間で解決されるにはあまりに複雑で、エラーが発生します「という表現は、妥当な時間で解決されるにはあまりに複雑で、明確な部分式への発現を壊し考える」スウィフト4 - 式はスウィフト4に目を向けると

let value = 
    Int(topLeft.hashValue) | 
    Int(topRight.hashValue) << 1 | 
    Int(bottomLeft.hashValue) << 2 | 
    Int(bottomRight.hashValue) << 3 

enter image description here

+2

それを1枚ずつですか? 'let value = Int(topLeft.hashValue);値=値| Int(topRight.hashValue)<< 1; 'など? – Larme

+0

'hashValue'はすでに' Int'です 'Int(...)'変換は必要ありません – JeremyP

+0

助けてくれてありがとうございます。 –

答えて

1
var value = topLeft.hashValue 
    value = value | topRight.hashValue << 1 
    value = value | bottomLeft.hashValue << 2 
    value = value | bottomRight.hashValue << 3 
+2

インプレース '| ='を使って、演算子、例えば 'value | = topRight.hashValue << 1' – Hamish

関連する問題