21 lines
312 B
Swift
21 lines
312 B
Swift
import Foundation
|
|
|
|
extension UInt16 {
|
|
|
|
init(high: UInt8, low: UInt8) {
|
|
self = UInt16(high) << 8 + UInt16(low)
|
|
}
|
|
|
|
var low: UInt8 {
|
|
UInt8(self & 0xFF)
|
|
}
|
|
|
|
var high: UInt8 {
|
|
UInt8(self >> 8 & 0xFF)
|
|
}
|
|
|
|
var integer: Int {
|
|
.init(self)
|
|
}
|
|
}
|