We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 1aa7bc3 + 3bc0a4b commit 7d333fdCopy full SHA for 7d333fd
Sources/Bits/Aliases.swift
@@ -12,3 +12,18 @@ public typealias Bytes = [Byte]
12
A sliced collection of raw data
13
*/
14
public typealias BytesSlice = ArraySlice<Byte>
15
+
16
+// MARK: Sizes
17
18
+private let _bytes = 1
19
+private let _kilobytes = _bytes * 1000
20
+private let _megabytes = _kilobytes * 1000
21
+private let _gigabytes = _megabytes * 1000
22
23
+extension Int {
24
+ public var bytes: Int { return self }
25
+ public var kilobytes: Int { return self * _kilobytes }
26
+ public var megabytes: Int { return self * _megabytes }
27
+ public var gigabytes: Int { return self * _gigabytes }
28
+}
29
0 commit comments