tangled
alpha
login
or
join now
khanwinter.com
/
CBOR
2
fork
atom
A fast, safe, and efficient CBOR serialization library for Swift on any platform.
swiftpackageindex.com/thecoolwinter/CBOR/1.1.1/documentation/cbor
atproto
swift
cbor
2
fork
atom
overview
issues
pulls
pipelines
Maybe fix test extension on linux
Khan Winter
6 months ago
051fd937
7dccdf34
+8
-1
1 changed file
expand all
collapse all
unified
split
Tests
CBORTests
Extensions
Data+hexString.swift
+8
-1
Tests/CBORTests/Extensions/Data+hexString.swift
···
12
12
#endif
13
13
14
14
extension Data {
15
15
+
private static let hexAlphabet = Array("0123456789abcdef".unicodeScalars)
16
16
+
15
17
func hexString() -> String {
16
16
-
map { String(format: "%02hhX", $0) }.joined()
18
18
+
// I'd rather use: map { String(format: "%02hhX", $0) }.joined()
19
19
+
// but that doesn't compile on linux...
20
20
+
String(reduce(into: "".unicodeScalars) { result, value in
21
21
+
result.append(Self.hexAlphabet[Int(value / 0x10)])
22
22
+
result.append(Self.hexAlphabet[Int(value % 0x10)])
23
23
+
})
17
24
}
18
25
}