diff --git a/Sources/Crypto/Util/Backports.swift b/Sources/Crypto/Util/Backports.swift index 878ca8fb..c14b4917 100644 --- a/Sources/Crypto/Util/Backports.swift +++ b/Sources/Crypto/Util/Backports.swift @@ -18,29 +18,20 @@ import FoundationEssentials import Foundation #endif -#if swift(<6.4) +#if compiler(<6.4) @available(macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2, visionOS 1.0, *) extension ContiguousBytes { func withBytes(_ body: (RawSpan) throws -> R) rethrows -> R { try withUnsafeBytes { try body(RawSpan(_unsafeBytes: $0)) } } } -#endif -#if swift(<6.4) @available(macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2, visionOS 1.0, *) extension MutableRawSpan { - #if swift(>=6.3) subscript(_ byteOffset: Int) -> UInt8 { get { unsafeLoad(fromByteOffset: byteOffset, as: UInt8.self) } + @_lifetime(self: copy self) set { storeBytes(of: newValue, toByteOffset: byteOffset, as: UInt8.self) } } - #elseif swift(<6.3) - subscript(_ byteOffset: Int) -> UInt8 { - get { unsafeLoad(fromByteOffset: byteOffset, as: UInt8.self) } - @_lifetime(&self) - set { storeBytes(of: newValue, toByteOffset: byteOffset, as: UInt8.self) } - } - #endif } #endif