TempTrack-iOS/TempTrack/Extensions/UInt16+Extensions.swift

21 lines
318 B
Swift
Raw Normal View History

2023-06-08 14:57:40 +02:00
import Foundation
extension UInt16 {
init(high: UInt8, low: UInt8) {
self = UInt16(high) << 8 + UInt16(low)
}
var low: UInt8 {
UInt8(clamping: self)
}
var high: UInt8 {
UInt8(clamping: self >> 8)
}
var integer: Int {
.init(self)
}
}