TempTrack-iOS/TempTrack/Extensions/UInt16+Extensions.swift
2023-06-08 14:57:40 +02:00

21 lines
318 B
Swift

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)
}
}