From 7c6d6d22ffa40d53cd80a5b95cc10040f6fcd58e Mon Sep 17 00:00:00 2001 From: Timofey Solomko Date: Wed, 22 Nov 2017 20:56:28 +0300 Subject: [PATCH] Replace UInt extensions with one extension to UnsignedInteger --- Sources/Common/Extensions.swift | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/Sources/Common/Extensions.swift b/Sources/Common/Extensions.swift index 47dc9f1b..972aa72c 100644 --- a/Sources/Common/Extensions.swift +++ b/Sources/Common/Extensions.swift @@ -19,36 +19,11 @@ extension Data { } -extension UInt8 { +extension UnsignedInteger { func toInt() -> Int { - return Int(bitPattern: UInt(self)) + return Int(truncatingIfNeeded: self) } - -} - -extension UInt16 { - - func toInt() -> Int { - return Int(bitPattern: UInt(self)) - } - -} - -extension UInt32 { - - func toInt() -> Int { - return Int(bitPattern: UInt(self)) - } - -} - -extension UInt64 { - - func toInt() -> Int { - return Int(bitPattern: UInt(self)) - } - } extension Int {