0001    //
0002    //  BigUInt Hashing.swift
0003    //  BigInt
0004    //
0005    //  Created by Károly Lőrentey on 2016-01-03.
0006    //  Copyright © 2016 Károly Lőrentey. All rights reserved.
0007    //
0008    
0009    import Foundation
0010    
0011    extension BigUInt: Hashable {
0012        //MARK: Hashing
0013    
0014        /// The hash value.
0015        public var hashValue
BigInt.swift:178
        let v = abs.hashValue
: Int { 0016 var hash: UInt64 = UInt64(count).byteSwapped 0017 for i in 0..<count { 0018 let shift: UInt64 = ((UInt64(i) << 5) - UInt64(i)) & 63 0019 let rotated = (hash >> shift) | ((hash & ((1 << shift) - 1)) << shift) 0020 hash = rotated ^ UInt64(UInt(truncatingBitPattern: Int64(self[i].hashValue &+ i))) 0021 } 0022 0023 return Int(truncatingBitPattern: hash) 0024 } 0025 } 0026