Hashable.swift 585 B

1234567891011121314151617181920212223242526
  1. //
  2. // Hashable.swift
  3. // BigInt
  4. //
  5. // Created by Károly Lőrentey on 2016-01-03.
  6. // Copyright © 2016-2017 Károly Lőrentey.
  7. //
  8. extension CS.BigUInt: Hashable {
  9. //MARK: Hashing
  10. /// Append this `BigUInt` to the specified hasher.
  11. public func hash(into hasher: inout Hasher) {
  12. for word in self.words {
  13. hasher.combine(word)
  14. }
  15. }
  16. }
  17. extension CS.BigInt: Hashable {
  18. /// Append this `BigInt` to the specified hasher.
  19. public func hash(into hasher: inout Hasher) {
  20. hasher.combine(sign)
  21. hasher.combine(magnitude)
  22. }
  23. }