ParityType.swift 248 B

123456789101112131415161718
  1. import Foundation
  2. public enum ParityType {
  3. case none
  4. case even
  5. case odd
  6. var parityValue: tcflag_t {
  7. switch self {
  8. case .none:
  9. return 0
  10. case .even:
  11. return tcflag_t(PARENB)
  12. case .odd:
  13. return tcflag_t(PARENB | PARODD)
  14. }
  15. }
  16. }