FruitMachine-Swift/FruitMachine/M6502/IntegerExtensions.swift

26 lines
492 B
Swift
Raw Normal View History

2017-07-21 07:25:48 +00:00
//
// IntegerExtensions.swift
// FruitMachine
//
// Created by Christopher Rohl on 7/20/17.
// Copyright © 2017 Christopher Rohl. All rights reserved.
//
import Cocoa
extension UInt16 {
static func + (left: UInt16, right: UInt8) -> UInt16 {
2017-07-24 00:40:48 +00:00
return left + UInt16(right)
2017-07-21 07:25:48 +00:00
}
func asHexString() -> String {
return String(format: "%04X", self)
}
2017-07-21 07:25:48 +00:00
}
extension UInt8 {
func asHexString() -> String {
return String(format: "%02X", self)
}
}